Hi,
I am really stuck on the most simplist of tasks you would think.
I have a MS Access database with users firstnames lastnames etc...
All I want to do is pass it a variable e.g. [firstname] and pull all information in the DB and display it.
Im using:
Visual Web Developer 2005
MS Access Database
Also I am not sure which namespaces to use, I have trawled the MSDN website, but find it extremely difficult to find what im looking for.Code:<script runat="server"> Sub OnbtnLoginClicked(ByVal s As Object, ByVal e As EventArgs) Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("tblUsers.mdb") & ";" Dim mySQL As String = "SELECT * FROM tblUsers WHERE firstname= & txtFirstname" Dim MyConn As New OleDBConnection(strConn) Dim cmd As New OleDBCommand(mySQL, MyConn) MyConn.Open() Dim objReader As OleDbDataReader objReader = cmd.ExecuteReader() While objReader.Read() Dim firstname As String = objReader("firstname") lblOutput.Text = firstname End While objReader.Close() MyConn.Close() End Sub </script>
(At the top of the .aspx page)
Any help would be greatly appreciated.Code:<%@ Page Language="VB" Debug="true" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.OleDB" %> <%@ Import Namespace="System.Data.OleDB.OleDbDataReader" %>
Thanks




Reply With Quote