Executing Sql Command -- Insert, Update And Delete
how can i make the function return true only if the execution is successfull (see bold red below)? Currently the function is returning true wheather it is successfull or not. Code:
View Replieshow can i make the function return true only if the execution is successfull (see bold red below)? Currently the function is returning true wheather it is successfull or not. Code:
View Repliescan u tell me of a simple script i can use to do the following. I want a textbox to add a entry to the database with a submit button, then below all that the current database entrys are listed below also in textboxes with a UPDATE and DELETE button beside each entry.
View Replies View RelatedI am using the below command to restart a service on one of my web
boxes, this runs fine from the command prompt and also through a *.bat
file.
"Server1Applist$BOBJCentralMSpsservice.exe" Server2 -u
eutee-ww02pUsername -p password restart BOBJCentralMS
I found this asp code in this forum but can not get it to work with my
command
<%
Dim oShell, sCommand
sCommand = "MyCommand"
Set oShell = CreateObject("WScript.Shell")
oShell.Run sCommand, , True
Set oShell = Nothing
%>
I replace "MYCommand" with the command i wish to execute but the page
just hangs with the blue status bar halfway complete at the bottom,
when checking the services on the box it is not restarted.
when i want to do an action to the database i am using the command
Set myConn = Server.CreateObject("ADODB.Connection")
myConn.Open = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("photoalbum.mdb") & ""
Set RS1 = myConn.Execute(SQL1)
is there something else i can use if it is only an INSERT statement in the sql because i dont actually need to create a recordset ?
My project is to go to this site: http://www.sanav.com/eric/gprs_read.aspx... write the text "351277000546068" in the textform and press submit. After I get the results of the page, I need the source of the page, either in a file locally or If it works I need to search for some strings on the results site.
So is there a way to do this programatically or is there a way to execute a POST command and call the same funciton as the website does?
Can someone give me some sample code on how one would go about executing a
command line "command" from within an ASP form?
We need to run an application called GnuPG which allows us to encrypt an
email.
Preferably some documentation directly on this would be good but any other
docuemtnation on executing a command line "command" would be great!
I have a problem with my database connection.
I have used access 2000 database with password of "chem"
i have use this connecion
<%
Dim con
Set con = Server.CreateObject("ADODB.Connection")
con.Provider = "Microsoft.Jet.OLEDB.4.0;" _
& "Jet OLEDBatabase Password=chem;"
dbPath=server.mappath("zahid.mdb")
con.ConnectionString =dbpath
'con.Open adOpenStatic, adLockoptimistic, adCmdTable
con.CursorLocation = 2
con.Open Trim(con)
'and for delete
con.Execute "delete from reservation where ID IN (" & a & ") ",,adCmdText + adExecuteNoRecords
%>
it is working fine when i want to show my all database records.
but when i want to delete the specified record it did'nt show any
thing.
i have a form that action is set to itself, on the same page i m having the insert statement, executed when i submit that form, but when the user refresh that page the query is executed and submit the null values in the table.
<form name=form1 action=form1.asp method=post>
<input type........
<input type.......
<input type=submit value....>
<input type=hidden name='insert' value=1>
</form>
<%
if request.form("insert") = 1 then
Execute the insert query
End If
%>
I am having trouble trying to figure out how to properly enter a checkbox in the SET statement so I can update the checkbox value based on user's input.
I know for number values you enter the variable like this:
Code:
Owner = own
and for text you enter like this:
Code:
Priority = 'pri'
and for dates you enter the variable like this:
Code:
tdate = #td#
but how do you create the variable in the SQL statement so it updates a checkbox value?
Below is my SQL statement, and the checkbox name is "Active" Code:
I am trying to insert a record into the LOG database when a user insert/update any record. I tried to log the username that currently logged in. If I do Response.write(Session("MM_Username")) then I see the username that I am logged in.
The below command if I use that fake value then it works, but I tried to log the current username it won't work. I think "Response.write(Session("MM_Username")) is NOT correct.
MM_editQuery = "INSERT INTO LOG (username) VALUES (" & (Session("MM_Username")) & ") "
I have this command running but get the following error. Code:
INSERT INTO Dis_expired ( DOverallID, Name, Dsize, Due_date ) SELECT disposable_issued.DOverallID, disposable_issued.Name, disposable_issued.Dsize, disposable_issued.Due_date FROM disposable_issued WHERE disposable_issued.Due_date<Date()
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
I am trying to read variables from a querystring and then input them into a table. I can read them in with no problem. But the problem I am coming across is that I cant add them into the database.
The insert command has to be first in the asp page which means that that method runs before it gets to "company = Request.Querystring("company_name")" So im guessing that if I could get it to request the querystring first then it would work but since the variable company hasnt been defined yet it wont work. I also tried :
if(Request.Querystring("company_name") <> "") then Command1__company = Request.Querystring("company_name")
before The insert command and this doesnt work either....I'm using dreamweaver.
I am having a problem with an insert SQL command, its the sql is not correct.Below is my Sub:
Dim sql
Sub addArticle()
sql = "INSERT INTO tblNews (newsDate, newsTitle, newsBody) " &_
"VALUES ('" & Request.Form("articledate") & Request.Form("articletitle") & Request.Form("articlebody") & ")"
dbExecute.Execute(sql)
End Sub
If I hard code values into the sql instead of the request.form it adds the data fine, but I cannot get my sql right in order to use the form inputs.
I am having a problem with an insert statement. I keep getting the following error:
2147217900 Syntax error in INSERT INTO statement. Here is my SQL statement:
INSERT INTO Notes (Note, Submitter, NoteDate, ContactID)
VALUES ('Barb us our Rep', 'DrM', '10/13/2004', '1')
I am not able to seee the error. Are there other problems that could give me this error that are not relative to the SQL Command. If I have made an error please help me to see it.
I have included my code below. I have created a form that pulls up data from a previous page that linked to this form. I have a update and delete button. Now my question is, how do I make the form update or delete from the database based on which button they push?
View Replies View RelatedI have been working on getting a database on the web, i have accomplshied being able to add new rocords to the database only now I need to be able to edit records and delete them as needed I have looked on various pages for help with figuring this out, but to no avail. I just need a little help in the right direction. If someone could point me in the right direction that would be great. I have FP 2000 its and access 2000 database.
View Replies View Relatedthis programe is read date for excel and export to mdb,if there exist the BID in mdb then update the date,else inert the date to mdb. Code:
View Replies View RelatedI have a form that pulls existing information from a database and allows users to edit it. Every field can be left blank if the user wishes.
I am having an issue with determining which SQL statement to run. There has to be an easier way to do this then what I am doing. For each filed I process the data this way:
SQL2="select * from 1985ClassList where MailingListID =" & Session("EID")
set aData = oConn.execute(SQL2)
Code:
I'm using a database to store the products in a basket.
It's this scenario:
A visitor already has some products in his basket and wants add some new ones.
Now, first I want to check if the selected products aren't already in the database.
1. if they are -> update the product when the amount number is changed
2. if the product is not in the database then insert it.
I'm stuck at the point that I can't retrieve if the database is updated, so I can either stop the query or insert the new product.
Java has a statement like getUpdateCount(), but ASP/VBSCRIPT??
I want the fastest solution, i dont want to retrieve the data twice and compare them to check if it changed..
I try to do an INSERT statement throught my ASP to add records to my Access DB. However I get an error when I execute this. The code in ASP is -
strSQL = "INSERT INTO tbl_psm (LocID, Week, Month, Year, Rating, Remark, Action, SubmittedDateTime) VALUES ('" &cint(intLocid)& "', '" &cint(sWeek)& "', '" &cint(sMonth)& "', '" &cint(sYear)& "', '" &cint(sRating)& "', '" &sRemark& "', '" &sAction& "', '" &formatdatetime(date,vbshortdate)& "');"
objConn.Execute strSQL
I get the error page Code:
I am submitting a comment box from a form into a database field that I have declared as text (16). When I type in a small amount of information, it submits just fine, but when I enter a substantial amount of data then I receive an error. I've tried different field types, but I keep getting the same error.
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 's'.
I have to compare 2 tables: orderA and orderB, if the record exists in both table orderB and orderA, just do a update to the quantity field in orderB (add orderA.quantity to orderB.quantity). Otherwise a new record has to be insert into orderB.
Do I have to loop through the recordset of orderB, then use select statement to see whether the record exists in orderA or not, and determine whether to update/insert record? I am using Access database. I just afraid that looping through each record in recordset (maybe >=30 record each time) would make the transaction getting slow (or even hang??). Can I do this in one SQL statement?
I want to insert the element selected by the user from the drop down box in the DB(Access).Once the user hits submit i want it to insert this in the DB + i want to update one of the fields from True to False . how can i perform both these at the same time?
View Replies View RelatedThe data that is entered into my website needs to be sent to someone else. Currently it is being put into a MySQL database. In addition to this, a third party needs this information. They have something set up on their website where I can do this:
https://www.domain.com/update.exe?src=username&data=Smith,John,5,12,Rose,Charlie
I have no control over domain.com. How can I update the record, send the data to this URL, and then redirect the user back to the default page? Right now it just inserts the record and then redirects to the default page. I'm unsure as to how to do the URL bit. I would prefer if the user did not see the domain switch.
After the page (transactions.asp) loads I want to allow the user to enter the number of transactions into the provided textboxes. Then, when the user clicks submit, I need to have all the hidden fields as well as the number of transactions values inserted into the transactions table of my database?
I have attached the database should you have any questions about the db table values and fields. Please let me know if you have any questions or need more information or files.
I didn't know how to use asp to update or insert the excel data ....
View Replies View RelatedI have a problem that it's bothering me for some time now and i will need a lot of help from you. I don't know how easy or difficult it is to be done but i would appreciate any help.
I have an mssql 2000 db with table "table1". Attributes for "table1" are:
ID (Primary Key)
field1
field2
field3
field4
field5
field6
field7
I'm trying through DreamWeaver MX to create a form through ASP and Text Fields, so that i can update "table1" through the form and also on another page to show the results of my table.
I have created a form which will be accepting 25 rows, each row having field1, field2, .., field7.
I cannot seem to get it to update "table1".
Any ideas how this can be done?
I am storing dates in a mySql database in the format yyyy-mm-dd. Now, I have set up so that this field is insert by a form.
It isn't very user friendly to have to type yyyy-mm-dd, how can I set up so that the user can enter format dd/mm/yyyy and it will automatically insert into the database as yyyy-mm-dd? I am using Dreamweaver MX 2004 and ASP.
how to declare session variables and use it in insert and update sql statements... the scenario is I have:
2 html forms
2 ASP FILES
I am able to trap data from the first form into the acces table..but my second form(which is continuation of first form) has a update query....(ie...it shld update the same record the one inserted from the 1st form )..both the forms work on table in access db
its an annonymus...questionnaite...therefore i am not trapping any user name or login id...but the requirement is the survey made shld be unique....as in no user shld be able to answer the questions twice.
I am getting the above error when trying to execute the following code:
View Replies View RelatedJust as the title says I am trying to do something impossible with a single SQL statement. I am doing an ASP webpage for internal use at the company I work for.
I want to know if there is a way to insert/update data into multiple tables in 1 SQL statement.
If it requires functions | views or anything else that is fine but I don't want to have 3-4 different SQL statements to update 2-3 different columns in different tables.
I have an online application. I get the following error when a user selects an option from one drop down list but doesn't select an option from another drop down list. Here is the error:
Microsoft OLE DB Provider for SQL Server error '80040e0c' Command Text was not set for the command object. Code:
I have an online application. I get the following error when a user selects an option from one drop down list but doesn't select an option from another drop down list. Here is the error:
Microsoft OLE DB Provider for SQL Server error '80040e0c'
Command Text was not set for the command object.
Line 87
Line 87 = rs1 = conn.execute(finalSQL)
Here is the page causing the error. Code: