Dim myConnection
Dim myConnectionStr
Dim myRecordSet
Dim mySQLSet myConnection = Server.CreateObject("ADODB.Connection")
myConnectionStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dataStores\webDbs\webLogin.mdb;"
myConnection.Open myConnectionStrSet myRecordSet = Server.CreateObject("ADODB.RecordSet")
mySQL = "SELECT tblUsers.userId FROM tblUsers WHERE (((tblUsers.emailAddress)='test@dotnet.itags.org.yahoo.com'));"
myRecordSet.Open mySQL, myConnectionIf Not myRecordSet.EOF Then
Session("userId") = myRecordSet("userId")
End IfmyRecordSet.Close
Set myRecordSet = Nothing
myConnection.Close
Set myConnection = Nothing
NOTE: Moderator fixed <Code> tags...Hi,
instead of a recordset you can use asqldatareader instead.
Alsoview forum 132.
Grz, Kris.
Sub Page_Load(s As Object, e As EventArgs)
lblResult.Text = getUserId()
End SubFunction getUserId() As String
Dim myConnection As OleDbConnection
Dim myConnectionStr As String
Dim myCommand As OleDbCommand
Dim myDataReader As OleDbDataReader
Dim mySQL As StringmyConnectionStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Datastores\LCS_Web\BoardElect.mdb;"
myConnection = New OleDbConnection(myConnectionStr)mySQL = "SELECT tblUsers.userId FROM tblUsers WHERE (((tblUsers.emailAddress)='test@.yahoo.com'));"
myCommand = New OleDbCommand(mySQL, myConnection)
myConnection.Open()
myDataReader = myCommand.ExecuteReader()myDataReader.Read()
getUserId = myDataReader.GetValue(0)myDataReader.Close()
myConnection.Close()
End Function
got it from another forum, but thanks
Does this help ?
PopUpWindow 1.1
regards
that's a very nice component you've written, but is there some correlation to the topic at hand?
0 comments:
Post a Comment