Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Parameters Not Working 1

Status
Not open for further replies.

jessedh

MIS
Apr 16, 2002
96
US
Hello,

I am new to ASP and can't get this to work. I am sure that it is something simple. Additionally, can some explain what the additional parameters in the rs.open line represent?

Thanks,
Jesse

<%@ Language=VBScript %>

<%

Dim conn
Dim rs
Dim strConn
Dim strSQL
Dim appNumb
Dim SQLstr

appNumb = Request.Form(&quot;txtAppNumb&quot;)

strSQL = &quot;SELECT tbl1Master.* FROM tbl1Master WHERE tbl1Master.[1ApplNumb])=&quot;&quot;&quot;& appNumb & &quot;&quot;&quot;;&quot;

'Create the object. In this case Connection to a database
Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)

'Select the provider
Conn.Provider = &quot;Microsoft.Jet.OLEDB.4.0&quot;

'Select the data source.
Conn.ConnectionString = &quot;Data Source=C:\Inetpub\
'Open the connection
Conn.Open

'Create a recordset object
Set Rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)

'Open the recordset with the connection created earlier
Rs.Open strSQL,Conn, 1,3

Response.write rs(0).value
%>

<br><br>

<%
Response.write appNumb
%>
 
A shot in the dark, seeing as you haven't actually told us what error you're getting - try changing your SQL line to:

Code:
strSQL = &quot;SELECT * FROM tbl1Master WHERE [1ApplNumb] = '&quot; & appNumb & &quot;'&quot;

--James
 
wow, you guys are awesome that worked!

I was getting an invalid SQL string.

can you tell what those parameters represent?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top