•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 456,499 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,735 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 5701 | Replies: 10
![]() |
do as i said-
1)open a form-drag&drop 2 labels,2textboxes& a button
2)on a button name it has (SUBMIT-button)
3)
create a table in sql-server with ur desired tablename
4)the table should have two fields-name,password.
5)entire the data into fields in database.
6)click on the submit button-of the form(in code-behind file)
just paste this code................................
PrivateSub sub_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sub_btn.Click
Dim cnn1 As String = ConfigurationSettings.AppSettings("preeconn")
Dim cmd As New SqlCommand("select * from tablename where password = & _ password.text & " ' )", New SqlConnection(cnn1))
cmd.Connection.Open()
cmd.ExecuteNonQuery()
cmd.Connection.Close()
loaddata()
End Sub
Private Sub LoadData()
Dim strSQL As String = "SELECT * FROM tablename "
Dim cnn As String = ConfigurationSettings.AppSettings("preeconn")
Dim cmd As New SqlCommand(strSQL, New SqlConnection(cnn))
cmd.Connection.Open()
Dim myCommand As New SqlDataAdapter(strSQL, cnn)
Dim ds As New DataSet
myCommand.Fill(ds, "table1")
cmd.Connection.Close()
cmd.Connection.Dispose()
End Sub
----------------------------------
in pageload. place this loadata() function
And u get the desired..reply m when ur done or when u have any queries...
1)open a form-drag&drop 2 labels,2textboxes& a button
2)on a button name it has (SUBMIT-button)
3)
create a table in sql-server with ur desired tablename
4)the table should have two fields-name,password.
5)entire the data into fields in database.
6)click on the submit button-of the form(in code-behind file)
just paste this code................................
PrivateSub sub_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sub_btn.Click
Dim cnn1 As String = ConfigurationSettings.AppSettings("preeconn")
Dim cmd As New SqlCommand("select * from tablename where password = & _ password.text & " ' )", New SqlConnection(cnn1))
cmd.Connection.Open()
cmd.ExecuteNonQuery()
cmd.Connection.Close()
loaddata()
End Sub
Private Sub LoadData()
Dim strSQL As String = "SELECT * FROM tablename "
Dim cnn As String = ConfigurationSettings.AppSettings("preeconn")
Dim cmd As New SqlCommand(strSQL, New SqlConnection(cnn))
cmd.Connection.Open()
Dim myCommand As New SqlDataAdapter(strSQL, cnn)
Dim ds As New DataSet
myCommand.Fill(ds, "table1")
cmd.Connection.Close()
cmd.Connection.Dispose()
End Sub
----------------------------------
in pageload. place this loadata() function
And u get the desired..reply m when ur done or when u have any queries...
•
•
Join Date: Dec 2006
Location: United States
Posts: 613
Reputation:
Rep Power: 3
Solved Threads: 15
Here is the best sample I have for you. It implements a sample login system using Ascess DB. You can also read the full article and download the source here
Let me know if you need further help.
Let me know if you need further help.
•
•
Join Date: Dec 2006
Location: United States
Posts: 613
Reputation:
Rep Power: 3
Solved Threads: 15
So was my article of any help?
•
•
Join Date: Dec 2006
Location: United States
Posts: 613
Reputation:
Rep Power: 3
Solved Threads: 15
Thats the codebehind page for the login.aspx page, every aspx page has a codebehind page.
Which ver. of VS are you using, 2003 or 2005?
Which ver. of VS are you using, 2003 or 2005?
•
•
Join Date: Aug 2007
Posts: 11
Reputation:
Rep Power: 2
Solved Threads: 0
Hi,
You assume there are two text box controls to accept user name and password and button control on login form.
void Button_Click(object sender, System.EventArgs e)
{
if (Page.IsValid)
{
switch (VerifyPassword( txtUsername.Text, txtPassword.Text )) {
case 0:
FormsAuthentication.RedirectFromLoginPage( txtUsername.Text, chkPersist.Checked );
break;
case 1:
lblError.Text = "You did not enter a valid username";
break;
case 2:
lblError.Text = "You did not enter a valid password";
break;
}
}
}
int VerifyPassword( string strUsername, string strPassword ) {
string strConString;
SqlConnection conJobs;
SqlCommand cmdVerify;
SqlParameter parmReturn;
strConString = "Data Source=202.XX.XXX.XX;database=jobsabc;User ID=jobs123;Password=cd546dc;";
conJobs = new SqlConnection( strConString );
cmdVerify = new SqlCommand( "VerifyPassword", conJobs );
cmdVerify.CommandType = CommandType.StoredProcedure;
parmReturn = cmdVerify.Parameters.Add( "@return", SqlDbType.Int );
parmReturn.Direction = ParameterDirection.ReturnValue;
cmdVerify.Parameters.Add( "@username", strUsername );
cmdVerify.Parameters.Add( "@password", strPassword );
conJobs.Open();
cmdVerify.ExecuteNonQuery();
conJobs.Close();
return (int)cmdVerify.Parameters["@return"].Value;
}
Changes for web.config file for the root directory.
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true"/>
<authentication mode= "Forms">
<forms name=".JobskenCookie" loginUrl="/sitejob/sitepass/loginform.aspx" />
</authentication>
</system.web>
</configuration>
In the above code, sitepass is the password protected subfolder.
Changes for web.config file for the password protected folder. You keep all the password protected .aspx files (which are related to transactions) in this folder.
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true"/>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>
Hope this helps.
How to program transactions in ASP.net
You assume there are two text box controls to accept user name and password and button control on login form.
void Button_Click(object sender, System.EventArgs e)
{
if (Page.IsValid)
{
switch (VerifyPassword( txtUsername.Text, txtPassword.Text )) {
case 0:
FormsAuthentication.RedirectFromLoginPage( txtUsername.Text, chkPersist.Checked );
break;
case 1:
lblError.Text = "You did not enter a valid username";
break;
case 2:
lblError.Text = "You did not enter a valid password";
break;
}
}
}
int VerifyPassword( string strUsername, string strPassword ) {
string strConString;
SqlConnection conJobs;
SqlCommand cmdVerify;
SqlParameter parmReturn;
strConString = "Data Source=202.XX.XXX.XX;database=jobsabc;User ID=jobs123;Password=cd546dc;";
conJobs = new SqlConnection( strConString );
cmdVerify = new SqlCommand( "VerifyPassword", conJobs );
cmdVerify.CommandType = CommandType.StoredProcedure;
parmReturn = cmdVerify.Parameters.Add( "@return", SqlDbType.Int );
parmReturn.Direction = ParameterDirection.ReturnValue;
cmdVerify.Parameters.Add( "@username", strUsername );
cmdVerify.Parameters.Add( "@password", strPassword );
conJobs.Open();
cmdVerify.ExecuteNonQuery();
conJobs.Close();
return (int)cmdVerify.Parameters["@return"].Value;
}
Changes for web.config file for the root directory.
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true"/>
<authentication mode= "Forms">
<forms name=".JobskenCookie" loginUrl="/sitejob/sitepass/loginform.aspx" />
</authentication>
</system.web>
</configuration>
In the above code, sitepass is the password protected subfolder.
Changes for web.config file for the password protected folder. You keep all the password protected .aspx files (which are related to transactions) in this folder.
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true"/>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>
Hope this helps.
How to program transactions in ASP.net
![]() |
•
•
•
•
•
•
•
•
DaniWeb VB.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
.net .net framework 3.0 access accounting software selection ajax asp business software code combo core custom data developer development dom dropdownlist erp systems evaluation evaluations fedora feed legacy linux microsoft module msdn net office project project management reader reuse selection skin software software selection software solutions sql technology evaluation theme vista weather web windows workflow xml xoap
- Vb.net Sample Project (Visual Basic 4 / 5 / 6)
- Need Freelance ASP.NET, MS SQL, C#, VB.NET Developer (Web Development Job Offers)
- ideas about projects in asp.net (ASP.NET)
- Asp.net 2.0 site (Website Reviews)
- ASP .NET Web Application setup? (VB.NET)
- are C#, VB.NET, ASP.NET part of new VS.NET? (ASP.NET)
- ASP.NET Freelance Programmer / Developer (IT Careers and Business)
- looking for downloading asp.net/sqql2000 erp software (ASP.NET)
- Running asp or asp.net on apache (Linux Servers and Apache)
Other Threads in the VB.NET Forum
- Previous Thread: Including a .BMP file in an installation
- Next Thread: do somebody know the hangaroo vb.net code?


Linear Mode