Syntax and DB connection problem - Page 2


Try this
Code:
Posted On: Friday 26th of October 2012 06:48:03 AM Total Views:  273
View Complete with Replies

RELATED TOPICS OF ASP PROGRAMMING LANGUAGE




syntax error in FROM clause

my code: Code: Set rsDev = Server.CreateObject("ADODB.Recordset") rsDev.CursorLocation = 3 strSQL = "set dateformat dmy SELECT * FROM news ORDER BY theDate DESC" rsDev.Open strSQL,Conn,adOpenStatic,adLockReadOnly,adCmdTable i dont see whats wrong there
VIEWS ON THIS POST

426

Posted on:

Friday 26th October 2012
View Replies!

syntax error

sql = "insert into branch_mail(company_id,branch_id,sender_name,sende r_email,sender_text,sender_company) values("& company_id &",'"& branch &"', '"& sender_name &"','"& sender_email &"', '"& mail &"','"& sender_company &"')" Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ','. /vijayenzxr/compmail.asp, line 56
VIEWS ON THIS POST

289

Posted on:

Friday 26th October 2012
View Replies!

GetElementById(variable) What's the syntax?

my thread lower down is dealing with moving text from one field to another and it has led me to another problem, how do you put the contents of a variable into getElementById() ie if I hard code it - getElementById("attach1") it works but it could be attach2, attach3, etc so I need a variable. but the syntax appears to need speech marks " " which turns the variable into a string and looses its value. attach1 is the the name of the first text field
VIEWS ON THIS POST

221

Posted on:

Friday 26th October 2012
View Replies!

syntax error in FROM clause - Page 2

Happy U got the right solution Shem Happy Programming...........
VIEWS ON THIS POST

301

Posted on:

Friday 26th October 2012
View Replies!

syntax error

I haven't been on the net for a long time- not developing much these days back at uni Anyway i keep getting a syntax error in this sql statement. Some of these fields are empty hense why i have put & "". Some of them such as kitchen is a yes/no in the database. One is a number field but is empty. This is not my database and it is crap. I have done a response.end and it seems fine. Does someone know what's wrong Code: set objconn = server.createobject("ADODB.connection") objconn.connectionstring = "dsn=Members" objconn.open if session("department") = "Marketing" then call Marketing() elseif session("department") = "Trading" then call Trading() elseif session("department") = "Finance" then call Finance() elseif session("Department") = "Rebate" then call Rebate() elseif session("Department") = "EDI" then call EDI() elseif session("Department") = "MarketingandTrading" then call Marketing() call Trading() elseif session("Department") = "ALL" then call Marketing() call Trading() call Finance() call Rebate() call EDI() end if objconn.execute(strsql) objconn.close set objconn = nothing Code: strSQL = "UPDATE [Members] SET [Member Name] = '" & request("Name") & "" & "', " strSQL = strSQL & "[Address Code] = " & request("branch") & "" & ", " strSQL = strSQL & "[Address_1] = '" & request("Address_1") & "" & "', [Address_2] = '" & request("Address_2") & "" & "', " strSQL = strSQL & "[Address_3] = '" & request("Address_3") & "" & "', [Address_4] = '" & request("Address_4") & "" & "', " strSQL = strSQL & "[Postcode] = '" & request("postcode") & "" & "', [telephone] = '" & request("telephone") & "" & "', " strSQL = strSQL & "[Fax No] = '" & request("fax_no") & "" & "', [Email] = '" & request("email") & "" & "', " strSQL = strSQL & "[s/holder] = '" & request("s_holder") & "" & "', " strSQL = strSQL & "[Alpha Type] = '" & request("Alpha_Type") & "" & "', [Member Type] = '" & request("Member_Type") & "" & "', " strSQL = strSQL & "[Area] = '" & request("Area") & "" & "', [bathroom] = '" & request("bathroom") & "" & "', " strSQL = strSQL & "[kitchen] = '" & request("kitchen") & "" & "', [heating] = '" & request("heating") & "" & "', " strSQL = strSQL & "[security] = '" & request("security") & "" & "', [toolhire] = '" & request("toolhire") & "" & "', " strSQL = strSQL & "[brick] = '" & request("brick") & "" & "', [glass] = '" & request("glass") & "" & "', " strSQL = strSQL & "[buying group member] = '" & request("buying_group_member") & "" & "' " strsql = strsql & "WHERE [A/C No] = '" & request("member") & "' "
VIEWS ON THIS POST

281

Posted on:

Friday 26th October 2012
View Replies!

Insert Into syntax error

, I am new to asp programming. I have encountered Insert Into syntax error when I execute the code below. Can anyone let me know what is the error
VIEWS ON THIS POST

314

Posted on:

Friday 26th October 2012
View Replies!

SQL syntax error

Microsoft OLE DB Provider for ODBC Drivers error '80040e09' [TCX][MyODBC]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' fnText = '' WHERE (id = )' at line 1 /AddDelEdit2.asp, line 162 Line 162 is: cnnDBEdit.Execute strSQL, adAffect, adCmdText Or adExecuteNoRecords
VIEWS ON THIS POST

282

Posted on:

Friday 26th October 2012
View Replies!

syntax error

hi........getting syntax error...... Code: response.write("") Microsoft VBScript compilation error '800a03ee' Expected ')' /comp_alpha.asp, line 54 response.write("
VIEWS ON THIS POST

292

Posted on:

Friday 26th October 2012
View Replies!

Incorrect syntax near the word

I converted my Access databases to MS SQL. I then changed the code in my ASP pages to compensate. I wanted to check that it would work. I ran into a problem: It keeps saying: [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'User'. BTW this piece of code works fine in Access and only crashes when using SQL. Can't find anything relevant on the Internet. Can someone help please Code: set objconn = server.createobject("ADODB.connection") objconn.connectionstring = "dsn=nmbs_sql;uid=web3;pwd=web3" objconn.open if flag=0 then objrs.addnew objrs("prefix")= prefix objrs("Customer") = customer objrs("Supplier") = Supplier objrs("voucher") = voucher objrs("narrative") = narrative objrs("Marked") = "No" objrs("Marked2") = "No" objrs("Marked3") = "No" objrs("Marked4") = "No" objrs("Marked5") = "No" objrs("Marked6") = "No" objrs("Marked7") = "No" objrs("Marked8") = "No" objrs("User") = Username 'ERROR ON HERE objrs("Date") = d objrs.update response.write "New item added, " & vbcrlf end if
VIEWS ON THIS POST

305

Posted on:

Friday 26th October 2012
View Replies!

most likely a dumb syntax error

Code: Response.Redirect (Response.write(CurrentID.Fields("TaInfoPage"))) Alright, I've currently got the CurrentID thing open and TaInfoPage has http://www.google.com stored in it. Am I not allowed to get URLs this way or do I just have a syntax error Error Type: Response object, ASP 0158 (0x80004005) A URL is required. /TAEscape.asp, line 32
VIEWS ON THIS POST

413

Posted on:

Friday 26th October 2012
View Replies!

Need help with Insert statement - syntax error

I am writing an Insert statement and receiving a syntax error. I cannot determine the problem, please help! Database is a simple .mdb, 2 fields: Text, Date db conn works fine also. Here is my test code: Dim oConn Dim oRs dim strTest strTest = "Test" Set oConn = Server.CreateObject("ADODB.Connection") oConn.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)}" oConn.ConnectionString = oConn.ConnectionString & ";DBQ=" & server.MapPath("./db/hp.mdb") oConn.Open (line 25) set oRs = oConn.Execute("INSERT INTO tblText(Text,Date) VALUES('" & strTest & "','" & strTest & "')") I receive the following error: Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement. /process_hometext.asp, line 25 I am unable to determine the problem, please help!
VIEWS ON THIS POST

290

Posted on:

Friday 26th October 2012
View Replies!

syntax error

hi, stuck on this products="select Item from Products1 where Item like %'" & searchname & "'%" gives an error like this incorrect syntax belord
VIEWS ON THIS POST

257

Posted on:

Friday 26th October 2012
View Replies!

Error in syntax insert statement

I have an error in my code somewhere , can someone please help. here is the error Error Type: Provider (0x80004005) Unspecified error /Emedia Studios Website/enquiry_form.asp, line 113 Browser Type: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) Page: POST 244 bytes to /Emedia Studios Website/enquiry_form.asp POST Data: companyname=bert&title=MR&contact=james&primary=01 214578&secondry=1245789&fax=1234567&email=df@dsfdf sdf.com&hear=Internet+Search&calltime=12pm+-+5pm&method=Fax&relates=Templates&enquiry=Please+h elp%0D . . . Here is my code
VIEWS ON THIS POST

302

Posted on:

Friday 26th October 2012
View Replies!

syntax question

hi there i have a table which i want to copy all the records from one table to another, (many different serialno. with the same product name) and at the same time delete those existing records in the table i did the following: Code: sql3 = "SELECT * FROM Serial WHERE PurchaseInvNo = '"&RS("PurchaseInvNo")&"'" Set RS4 = objConn.Execute(sql3) While NOT RS4.EOF Dim insertQuery insertQuery = "INSERT INTO PurgedSerial VALUES "&_ "('"&RS4("SerialNo")&"', '"&RS4("PartNo")&"', '"&RS4("SalesInvNo")&"', '"&RS4("PurchaseInvNo")&"');" objConn.Execute(insertQuery) Dim deleteSQL3 deleteSQL3 = "Delete From Serial Where PurchaseInvNo='"&RS4("PurchaseInvNo")&"'" 'Response.Write(deleteSQL) objConn.Execute(deleteSQL3) RS4.MoveNext Wend but it seems that the insert query only inserts one record (it doesnt seem to move next)while all deleted query deletes all the records that are stated
VIEWS ON THIS POST

190

Posted on:

Friday 26th October 2012
View Replies!

JOIN syntax problem...I think.

I'm trying to put together an ASP page while will allow a user to select the letter of a last name, and then sort the data to only display records with that particular last name. I'm providing information from three different tables and I'm having a problem displaying the data. My query does work b/c I've used it several times. I am using a MSSQL Server 2000 database. Here is my error message: Error Type: ADODB.Recordset (0x800A0CC1) Item cannot be found in the collection corresponding to the requested name or ordinal. /alpha.asp, line 63 Here is my code: Code: Houston County Case Management
VIEWS ON THIS POST

202

Posted on:

Friday 26th October 2012
View Replies!

PLS help, syntax error in INSERT statement

Hi all! I am writing this really simple guestbook page, with access to a DB. Connection works fine, I can easily read all the stuff from the DB and display it. Problems occur when I want to insert a new post getting data from a form. More specifically, I get this: Microsoft JET Database Engineerror '80040e14' Syntax error in INSERT INTO statement. /HOOD/insertPost.asp, line 42 Now, I have used this particular code I am posting here to insert into tons of DB's from ASP pages, I simply re-adapted it to the present needs. Here is the code: Code: Dim strDBpath, cnnSimple, rsetSimple, rsetInsert Dim vNick, vEmail, vMsg, addquery strDBPath = Server.MapPath("../mdb-database/HOOD/HOOD_gb.mdb") Set rsetInsert = Server.CreateObject("ADODB.Recordset") Set cnnSimple = Server.CreateObject("ADODB.Connection") cnnSimple.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";" vNick = Request.Form("txtNick") vEmail = Request.Form("txtEmail") vMsg = Request.Form("txtMsg") addquery = "INSERT INTO gb (User, Email, Msg, PostDate) VALUES ('" & vNick & "', '" & vEmail & "', '" & vMsg & "', '" & Date & "');" Response.Write(addquery) Set rsetInsert = cnnSimple.execute(addquery) The Code: Response.Write(addquery) is there simply for debugging purposes, and it gives this: INSERT INTO gb (User, Email, Msg, PostDate) VALUES ('blabla', 'blabla@bla.com', 'hello!', '27/01/2005'); Which, in my opinion, is a perfectly correct SQL insert statement... The line on which the error occurs is the last one of the pasted code, the execute command. I'd really appreciate any help, I have to get this done pretty fast... Alex
VIEWS ON THIS POST

350

Posted on:

Friday 26th October 2012
View Replies!

syntax problem

this is just a matter of syntax i think but i can'yt make anything of it. im=request("id") if ..... then ...... else Response.Redirect("http://www.someserver/") i get an error saying it expects a ')' why doesn't it see the ) caracter.... i still coudn't figure out much of the " or the ' parts of the code. can you please explain me when to use it\t\t tks
VIEWS ON THIS POST

187

Posted on:

Friday 26th October 2012
View Replies!

SQL syntax error

Hi all, this should be an easy one... I have: fourthSQL = "SELECT * FROM volunteers WHERE VID =" & VID & "" I get: Syntax error (missing operator) in query expression 'VID ='. VID is a number, any help is apprecited,
VIEWS ON THIS POST

162

Posted on:

Friday 26th October 2012
View Replies!

SQL syntax error - Page 3

if there are only 2 records in your database table, why is it returning 7x"No records in your rs_nonOps"\t\t it should only print that twice, once for each loop of the rs_Ops recordset. what data do you have for rs_nonOps
VIEWS ON THIS POST

299

Posted on:

Friday 26th October 2012
View Replies!

SQL syntax error

Can I know whats wrong with the SQL statement\t Error Type: Microsoft VBScript compilation (0x800A0401) Expected end of statement
VIEWS ON THIS POST

125

Posted on:

Friday 26th October 2012
View Replies!