• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1011
  • Last Modified:

SQL Active Sever Pages

Hello,
I need  your help, please!

I've been using JavaScript for all my asp pages for this project, and just found out that my form E-mail only works with VBScript, so now I have to convert all my JavaScript to VBScript; I don't think  I can use both languages on the same page, right?

I have two asp pages, Sending.asp and Receiving.asp. The Sending.asp form posts to Receiving.asp thenv inserted the data into an access database, that's where I have the SQL Insert statement in receiving.asp.

Anyway here is my question/problem;  I'm getting this error message with my sql insert statement, I'm no expert with SQL stuff so I need your hlep. I would really really appriciate any help I can get.

Here is the error message:

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/EmailConfirmTest.asp, line 12

con.Open "PROVIDER=SQLOLEDB;DATA SOURCE=D:\\myhost\\myweb\\Database\\mydatabasename.mdb");
----------------------------------------------------------------------------------------^

And here is my SQL statement I have on my receiing page:

<%
Dim sql_insert, con, LN, FN

SET con = Server.CreateObject("adodb.connection")

con.Open "PROVIDER=SQLOLEDB;DATA SOURCE=D:\\myhost\\myweb\\Database\\mydatabasename.mdb")

LN = Replace(Request.Form("CRLastName"),"'","''")
FN = Replace(Request.Form("CRFirstName"),"'","''")

sql_insert = "insert into mytable(CRLastName, CRFirstName) values( '" & LN & "','" & FN & "' )"
con.Execute (sql_insert)

con.close
SET con = Nothing
%>
0
lazzydog
Asked:
lazzydog
  • 3
  • 3
2 Solutions
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
You put the closed quote in the wrong place - use:
con.Open "PROVIDER=SQLOLEDB;DATA SOURCE=D:\\myhost\\myweb\\Database\\mydatabasename.mdb);"
0
 
lazzydogAuthor Commented:
Tried that and got an invalide authorization specification, any ideas what that is?

Microsoft OLE DB Provider for SQL Server error '80040e4d'

Invalid authorization specification

/ConfReg2006Confirm_EmailTest.asp, line 35


0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
Line 35 is a different line, so you have another error.

And you haven't posted the code of that page in and around line 35.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
lazzydogAuthor Commented:
Actually I was testing it on a different page. Sorry about that. Tested on that same page and got same error message.

Microsoft OLE DB Provider for SQL Server error '80040e4d'

Invalid authorization specification

/EmailConfirmTest.asp, line 12

this is what I have on line 12
con.Open "PROVIDER=SQLOLEDB;DATA SOURCE=D:\\shome\\myweb\\Database\\mydatabasename.mdb);"
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
Try using this, substituting appropriate information for your situation:

Con.Open "DBQ=" & Server.MapPath("database.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;MaxBufferSize=8192;Threads=20;", "username", "password"

Modified slightly from the sample here:
http://www.asp101.com/samples/viewasp.asp?file=database%2Easp

0
 
Anthony PerkinsCommented:
>>con.Open "PROVIDER=SQLOLEDB;DATA SOURCE=D:\\shome\\myweb\\Database\\mydatabasename.mdb);"<<
You do not need to escape your \ using VBScript like you do in JavaScript.
0
 
lazzydogAuthor Commented:
Thanks for you guys input, it turned out I got the script to work with javascript. But I'm going to give you guys points anyway for the input.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now