Anyone can help me connect to SQL Server through VB.net using ASP.NET Webform .. My database name is user and I want to use the database for the login page. Please help me ..
Personal Sub Button1_Click (ByVal This System.Object, ByVal E System. As EventArgs handles as Button1.Click ConnectionString dim string ConnectionString = ConfigurationSettings.AppSettings ("ConnectionString") as a Thief Thor New SqlConnection (ConnectionString) In the form of the new SqlCommand, the cmd dim ("thief" user-id, select user from public building department ") con.Open () dim myreader as SqlDataReader myreader = cmd.ExecuteReader () while myreader.Read ( ) If TxtUserId.Text = myreader ("user-id"). ToString () Trim () andalso TxtPwd.Text = myreader ("PWD"). ToString () The trim () session again ("user id") = TxtUserId.Text Response.Redirect ("UserMyProfile.aspx"), otherwise lblMsg.Visible = true lblMsg.Text = "Inavalid User-ID / Password" means the last end when the con .close () End Sub
There is no shortage of tutorials on the Web , But there is a good starting point.
Edit: Based on your comments above, it seems that you are not importing Namespace to the ADO.NET Data Object the wanted. Try adding it to a class file: Import system. Data.SqlClient
Comments
Post a Comment