| | |
login Form using Access database
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
man,its simple task-
dont worry,just create textbox& in properties make textmode-has password.to check whether name exists or not in password
private sub btn_check(sender,object)
Dim str AsString = "select ID from table1 where ID = '" & txtid.Text & "'"
Dim con As String = ConfigurationManager.AppSettings("preeconn")
Dim com As New SqlCommand(str, New SqlConnection(con))
com.Connection.Open()
'Dim ds As New DataSet
Dim da As New SqlDataAdapter(str, con)
'dataadapter is used to populate(or fill) dataset with data .we use fill method....
Dim dr As SqlDataReader
'da.Fill(ds, "table1")
dr = com.ExecuteReader 'where sqldatareader ain't run without using sqlcommand
'executereader,executenonquery are methods of sqlcommand....
'hasrows,fieldcount...are methods of datareader....
If Not dr.Read() Then
label4.Text = "id doesnt exists"
Else
label4.Text = "id exists"
End If
End Sub
dont worry,just create textbox& in properties make textmode-has password.to check whether name exists or not in password
private sub btn_check(sender,object)
Dim str AsString = "select ID from table1 where ID = '" & txtid.Text & "'"
Dim con As String = ConfigurationManager.AppSettings("preeconn")
Dim com As New SqlCommand(str, New SqlConnection(con))
com.Connection.Open()
'Dim ds As New DataSet
Dim da As New SqlDataAdapter(str, con)
'dataadapter is used to populate(or fill) dataset with data .we use fill method....
Dim dr As SqlDataReader
'da.Fill(ds, "table1")
dr = com.ExecuteReader 'where sqldatareader ain't run without using sqlcommand
'executereader,executenonquery are methods of sqlcommand....
'hasrows,fieldcount...are methods of datareader....
If Not dr.Read() Then
label4.Text = "id doesnt exists"
Else
label4.Text = "id exists"
End If
End Sub
•
•
Join Date: Oct 2007
Posts: 2
Reputation:
Solved Threads: 0
I tried create login form with following code:
Code
Dim str As String = "SELECT [userID], [passid] FROM user WHERE [userid]='" & txtUsername.Text & "' and [passid] = '" & txtPassword.Text & "'"
Dim con As String = ConfigurationManager.AppSettings("preeconn")
Dim com As New SqlClient.SqlCommand(Str, New SqlClient.SqlConnection(con))
com.Connection.Open()
'Dim ds As New DataSet
Dim da As New SqlClient.SqlDataAdapter(Str, con)
'dataadapter is used to populate(or fill) dataset with data .we use fill method....
Dim dr As SqlClient.SqlDataReader
'da.Fill(ds, "table1")
dr = com.ExecuteReader 'where sqldatareader ain't run without using sqlcommand
'executereader,executenonquery are methods of sqlcommand....
'hasrows,fieldcount...are methods of datareader....
If Not dr.Read() Then
MessageBox.Show("Invalid user name, try again!", "Invalid Info")
'label4.Text = "id doesnt exists"
Else
Form2.Show()
'label4.Text = "id exists"
End If
It show error Invalidoperationexception was unhandled "The connectionstring property has not been initialized.
Please advice me. I try create login form more then 1 month. I need it very urgent.
Code
Dim str As String = "SELECT [userID], [passid] FROM user WHERE [userid]='" & txtUsername.Text & "' and [passid] = '" & txtPassword.Text & "'"
Dim con As String = ConfigurationManager.AppSettings("preeconn")
Dim com As New SqlClient.SqlCommand(Str, New SqlClient.SqlConnection(con))
com.Connection.Open()
'Dim ds As New DataSet
Dim da As New SqlClient.SqlDataAdapter(Str, con)
'dataadapter is used to populate(or fill) dataset with data .we use fill method....
Dim dr As SqlClient.SqlDataReader
'da.Fill(ds, "table1")
dr = com.ExecuteReader 'where sqldatareader ain't run without using sqlcommand
'executereader,executenonquery are methods of sqlcommand....
'hasrows,fieldcount...are methods of datareader....
If Not dr.Read() Then
MessageBox.Show("Invalid user name, try again!", "Invalid Info")
'label4.Text = "id doesnt exists"
Else
Form2.Show()
'label4.Text = "id exists"
End If
It show error Invalidoperationexception was unhandled "The connectionstring property has not been initialized.
Please advice me. I try create login form more then 1 month. I need it very urgent.
•
•
Join Date: Aug 2007
Posts: 1
Reputation:
Solved Threads: 0
It is not clear to me that you have actually added a connection string to the app.config file. Be sure that the application settings parameter "preecon" has a valid DB connection string as it's value. The following is a sample of a SQL Server connection string in a local app.config file; I am not sure what an Access connection string would look like.
<configuration>
<appSettings>
<add key="preecon" value="server=HOSTNAME;database=DBNAME;Security=SSPI"/>
</appSettings>
</configuration>
Cheers,
BD
<configuration>
<appSettings>
<add key="preecon" value="server=HOSTNAME;database=DBNAME;Security=SSPI"/>
</appSettings>
</configuration>
Cheers,
BD
![]() |
Similar Threads
- Writing to an Access Database (Visual Basic 4 / 5 / 6)
- HELP pls, making a Login form. (Visual Basic 4 / 5 / 6)
- load data from access database into form (VB.NET)
- HELP: User Log In From Connected in Access Database (C#)
- Updating an Access database with a secondary form (VB.NET)
- Login form in VB.net (VB.NET)
- Need help to create a login form (VB.NET)
- Registration and Login scripts using VB and Oledbconnection to Access Database (ASP.NET)
Other Threads in the VB.NET Forum
- Previous Thread: VB.net help
- Next Thread: Context Menu Auto Close doesnt work for me
| Thread Tools | Search this Thread |
.net .net2008 30minutes 2005 2008 access account arithmetic array basic bing button buttons center check code combobox component connectionstring crystalreport data database databasesearch datagrid datagridview date design dissertation dissertations dropdownlist excel fade file-dialog filter folder ftp generatetags google gridview hardcopy images input insert intel internet mobile monitor ms net networking objects output panel passingparameters peertopeervideostreaming picturebox picturebox1 port position print printing problem problemwithinstallation project save searchbox searchvb.net select serial shutdown soap survey table tcp temperature text textbox timer timespan toolbox trim update updown user vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf year





