When i connect to SQL server from ASP, i could get through but i kindda of not sure how to use it.
Could you pls help me and show me the coding to use it.
My coding when i connect to SQL server from ASP:
Dim conn,strSQL,rs
set conn=Server.CreateObject("ADODB.Connection");
conn.ConnectionString="driver={SQL Server};"&_.........
..............
strySQL="Select empName from employee"
set rs=Server.CreateObject("ADODB.Recordset")
conn.Open
rs.Open strSQL,conn
Maybe you could show me how to save something into the database.
any field given.
Thanxdeclare one more variable in your asp script and change the strySQL code like the below,
Dim val
Dim conn,strSQL,rs
set conn=Server.CreateObject("ADODB.Connection");
conn.ConnectionString="driver={SQL Server};"&_.........
..............
strySQL="insert into employee values('& val &')"
set rs=Server.CreateObject("ADODB.Recordset")
conn.Open
rs.Open strSQL,conn
'try it.....|||http://support.microsoft.com/default.aspx?scid=kb;EN-US;176380 &
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q169/3/77.asp&NoWebContent=1 further information.
And http://www.devarticles.com/c/a/ASP/Two-Ways-To-Connect-To-SQL-Server-2000-Via-ASP/ loads of articles about ASP & SQL Server.|||try this code:
Dim conn,strSQL,rs
set conn=Server.CreateObject("ADODB.Connection");
conn.ConnectionString="driver={SQL Server};"&_.........
..............
strySQL="Select empName from employee"
set rs = conn.execute(strySQL)
.
.
.
and it returns the recordset to rs variable...then you can get data from rs like this:
do while not rs.EOF
Response.Write rs(0)
rs.movenext
loop
write if it works for you...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment