G
Guest
Hi,
I would like to have my web connect to a SQL Server and display data on a web form. My question is if a Social Security Number is not is the database, error occurs... what should i do... thanks
<%@ Page Language="VB" debug="true" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@import namespace="system.data"%>
<%@import namespace="system.data.oledb"%>
<%@import namespace="system.data.sqlclient"%>
<script runat=server>
sub checklastname(Source as Object,E as EventArgs)
Dim Conn as oledbconnection
Dim myadapter as OleDbDataAdapter
dim mydataset as new dataset
conn=new oledbconnection ("Provider=SQLOLEDB;Data Source=datasourcename;Database=databasename;User ID=;Password=;")
Conn.open()
myadapter=new OleDbDataAdapter("Select lastname from testtable where ssn=123121234;",conn)
myadapter.Fill(mydataset,"test") 'Error occurs since the number 123121234 is 'not in the system
txtlastname.text=mydataset.tables("test").rows(0).Item("lastname")
conn.close()
end sub
I would like to have my web connect to a SQL Server and display data on a web form. My question is if a Social Security Number is not is the database, error occurs... what should i do... thanks
<%@ Page Language="VB" debug="true" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@import namespace="system.data"%>
<%@import namespace="system.data.oledb"%>
<%@import namespace="system.data.sqlclient"%>
<script runat=server>
sub checklastname(Source as Object,E as EventArgs)
Dim Conn as oledbconnection
Dim myadapter as OleDbDataAdapter
dim mydataset as new dataset
conn=new oledbconnection ("Provider=SQLOLEDB;Data Source=datasourcename;Database=databasename;User ID=;Password=;")
Conn.open()
myadapter=new OleDbDataAdapter("Select lastname from testtable where ssn=123121234;",conn)
myadapter.Fill(mydataset,"test") 'Error occurs since the number 123121234 is 'not in the system
txtlastname.text=mydataset.tables("test").rows(0).Item("lastname")
conn.close()
end sub