Click to See Complete Forum and Search --> : Generate SQL statements in ASP/VB


shanuragu
09-12-2003, 03:16 AM
Hi

Is it possible to generate SQL statements in ASP/Visual Basic based on some pre decalred values/some conditions.

shara

rdoekes
09-12-2003, 05:22 AM
yes you can.

Dim strSQL 'as string
Dim strInputFromForm ' as string
Dim oCnn 'as adodb.connection

stInputFromForm = Request.Form("someField")
strSQL = "INSERT INTO table (someField) VALUES ('" & _
strInputFromForm & "')"

Set oCnn = Server.CreateObject("ADODB.Connection")
oCnn.Open "connectionstring"

oCnn.Execute strSQL
oCnn.Close
Set oCnn = Nothing

Hope this helps

-Rogier Doekes

shanuragu
09-13-2003, 01:56 AM
thanks for ur timely help!!:p