Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: capturing a value


Message #1 by "Navnit Bhatia" <nav78@u...> on Thu, 24 May 2001 08:33:17
hello, anyone could help me in capturing a value from a txtbox and 

comparing it with a value from sql database. How do i write an sql query 

for it?
Message #2 by "Charles Feduke" <webmaster@r...> on Thu, 24 May 2001 08:46:26 -0400
	Assuming your FORM's METHOD is "POST", it would look something like this:



Dim sSQL, rsRecordset, sConString

' set the connection

sConString = "your valid DSN connection string here"

' create the rs object

Set rsRecordset = Server.CreateObject("ADODB.Recordset")

' create the SQL

sSQL = "SELECT * FROM some_table WHERE " & _

	"last = '" & Replace(Request.Form("last"), "'", "''") & "' " & _

	"ORDER BY last"

' get the data

rsRecordset.Open sSQL, , adOpenForwardOnly

' cycle the data

Do Until rsRecordset.EOF

	Response.Write rsRecordset("first") & _

		" " & rsRecordset("last") & "<BR>" & vbCrLf

Loop



	You should seriously consider getting a book on ASP and/or ASP databases

(both are available from Wrox).



? Chuck



> -----Original Message-----

> From: Navnit Bhatia [mailto:nav78@u...]

> Sent: Thursday, May 24, 2001 8:33 AM

> To: ASP Databases

> Subject: [asp_databases] capturing a value

>

>

> hello, anyone could help me in capturing a value from a txtbox and

> comparing it with a value from sql database. How do i write an sql query

> for it?

>


  Return to Index