| | |
login Form using Access database
Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
![]() |
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
Views: 12958 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2008 access advanced application array basic beginner browser button buttons center class click client code combo convert cuesent data database datagrid datagridview date datetimepicker design designer dissertation dissertations dissertationtopic eclipse excel exists fade filter forms function html images lib listview map mobile module msaccess net number objects open panel pdf picturebox picturebox2 port position print printing problem read refresh regex richtextbox right-to-left save search serial settings shutdown socket sorting sqldatbase sqlserver studio temperature textbox timer timespan transparency txttoxmlconverter usercontol validation vb vb.net vb2008 vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web webbrowser winforms winsock wpf wrapingcode xml year





