•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 426,517 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,086 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 ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 143211 | Replies: 145
![]() |
•
•
•
•
Originally Posted by angelicjess
Sorry, I'm kinda noob in this... I do not know how to find out my version of ASP.NET.
I insert Imports.System.Data.SqlClient on top, although the KeyName is no longer showing error but when I used breakpoint, this statement show error >>> Dim MyConn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("strConn"))
Is the information enough?
Ok be sure you have all of the following imports:
When keywords are not recognized, that is the first thing to check.
**Copy and Paste doesn't always solve this**

Imports System.Web.Security ' |||||| Required Class for Authentication
Imports System.Data ' |||||| DB Accessing Import
Imports System.Data.SqlClient ' |||||| SQL Server Import
Imports System.Configuration ' |||||| Required for Web.Config appSettings |||||And be sure you have this line in your Web.Config file.
<appSettings>
<add key="strConn" value="Network Library=DBMSSOCN;Data Source=192.168.0.100,1433;database=Northwind;User id=;Password=;"/>
</appSettings>Let me know how it goes..
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
•
•
Join Date: May 2006
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
Sorry, let me give you a clearer picture first. I'm using Access Database and I named my Database as User.mdb. My table is called tblUser. Inside the table got U_id, U_Name and U_Password. I haven't create any Query because the SQL statement you wrote on the first page will always prompt me the value of the parameter. So in the end I deleted it. Is it purpose to be this way?
I also create a Login Page named Login.aspx. My form have:
- txtUsername
- txtPassword
- cmdSubmit
- lblMessage
Thus, I would like to learn from you what should I put for my query and how can I connect to the Access Database so that my login page is workable? I really appreciate your help. =) Thank you in advance!
I also create a Login Page named Login.aspx. My form have:
- txtUsername
- txtPassword
- cmdSubmit
- lblMessage
Thus, I would like to learn from you what should I put for my query and how can I connect to the Access Database so that my login page is workable? I really appreciate your help. =) Thank you in advance!
•
•
•
•
Originally Posted by angelicjess
Sorry, let me give you a clearer picture first. I'm using Access Database and I named my Database as User.mdb. My table is called tblUser. Inside the table got U_id, U_Name and U_Password. I haven't create any Query because the SQL statement you wrote on the first page will always prompt me the value of the parameter. So in the end I deleted it. Is it purpose to be this way?
I also create a Login Page named Login.aspx. My form have:
- txtUsername
- txtPassword
- cmdSubmit
- lblMessage
Thus, I would like to learn from you what should I put for my query and how can I connect to the Access Database so that my login page is workable? I really appreciate your help. =) Thank you in advance!
Ok, I can definitely help.
First off I highly recommend you READ through the tutorial again. I am being serious, and not in a bad way.
Why? Your statement:
•
•
•
•
I haven't create any Query because the SQL statement you wrote on the first page will always prompt me the value of the parameter. So in the end I deleted it. Is it purpose to be this way?
This demonstrates that you may not understanding what the purpose each line of code I have provided is doing. So let me see if I can better clarify what is happening.
To begin this SQL statement used in Access is correct:
SELECT COUNT(*) AS Num_of_User
FROM tblUser
WHERE (((tblUser.U_Name)=[@UserName]) AND ((tblUser.U_Password)=[@Password]));The query is suppose to prompt you; it will in Access as the @UserName & @Password are parameters the query is expecting to do the processing against the database on. What you are doing wanting to do is pass in the values entered into the ASP.NET control (i.e. username & password textboxes) into these paramters. Otherwise how would you provide the query with the values entered? And how else would you qualify the query? Meaning; how would you find out if the password entered is correct for the username entered?
Here is another important point. Your initial error was with the SQLConnection object not being recognized, but you are now saying you are using an Access Database.
Which are you using? An SQL database or Access?
If it is truly Access you are using then the imports you need are those directed at the start of this tutorial:
Imports System.Web.Security ' |||||| Required Class for Authentication Imports System.Data ' |||||| DB Accessing Import Imports System.Data.SqlClient ' |||||| SQL Server Import Imports System.Configuration ' |||||| Required for Web.Config appSettings |||||
Link to the start of this tutorial - using an Access Database
Hope this helps.
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
•
•
Join Date: May 2006
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
I'm Sorry... The login page is still not working. I do not know what went wrong. I'm using Access DB.
Imports System.Web.Security ' |||||| Required Class for Authentication
Imports System.Data ' |||||| DB Accessing Import
Imports System.Data.SqlClient ' |||||| SQL Server Import
Imports System.Configuration ' |||||| Required for Web.Config appSettings |||||
I've changed the above code from Imports.System.Data.SqlClient to Imports.System.Data.OleDBConnection. Because I'm not using SQL Server. Am I right to do so? I've also create a new databse which I had followed the codes on the first page. So could you paste the rest of the codes which I need for me? The first page is kinda confusing for me. I'm really new at this. This is the first time I'm doing this. Please...
Imports System.Web.Security ' |||||| Required Class for Authentication
Imports System.Data ' |||||| DB Accessing Import
Imports System.Data.SqlClient ' |||||| SQL Server Import
Imports System.Configuration ' |||||| Required for Web.Config appSettings |||||
I've changed the above code from Imports.System.Data.SqlClient to Imports.System.Data.OleDBConnection. Because I'm not using SQL Server. Am I right to do so? I've also create a new databse which I had followed the codes on the first page. So could you paste the rest of the codes which I need for me? The first page is kinda confusing for me. I'm really new at this. This is the first time I'm doing this. Please...
•
•
Join Date: Jun 2006
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Greetings all. I am very green at .net, learning as I go at this point. Is there a way to "adapt" the code here to be usable on the 2.0 Framework? I am building a basic webform for a project at work that pulls a dropdown list from an SQL DB, and I have an editing page to manage it, but of course it needs to be protected so anyone can't just go in and make changes. I build the entire login script based on the notes here, with the usual couple tweaks, but get the error "A first chance exception of type 'System.InvalidOperationException' occurred in System.Data.dll" when I run in debug mode after entering the name/password. The form always returns the "invalid login!" message regardless as well. I am writing in vb.net 2k5 at this time, but haven't learned all the features as of yet either. -- Thanks for any assistance anyone can provide! --
•
•
•
•
Originally Posted by E_Hobbie_Coder
Greetings all. I am very green at .net, learning as I go at this point. Is there a way to "adapt" the code here to be usable on the 2.0 Framework? I am building a basic webform for a project at work that pulls a dropdown list from an SQL DB, and I have an editing page to manage it, but of course it needs to be protected so anyone can't just go in and make changes. I build the entire login script based on the notes here, with the usual couple tweaks, but get the error "A first chance exception of type 'System.InvalidOperationException' occurred in System.Data.dll" when I run in debug mode after entering the name/password. The form always returns the "invalid login!" message regardless as well. I am writing in vb.net 2k5 at this time, but haven't learned all the features as of yet either. -- Thanks for any assistance anyone can provide! --
Hi E_Hobbie_Coder,
You say you are using VB.Net 2K5? Well this code only works with ASP.NET 1.0 or 1.1. It will not function (do to several Framework changes) in ASP.NET 2.0, or VB.NET 2k5 (which would require major code changes to from this tutorial).
Provide the code you are having issues with and I can see what I can do to help.
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
•
•
Join Date: Jun 2006
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
Hi,
I'm new to ASP.net and SQl server,
I'm using VS 2003 and SQL 2005 express edition,
I followed thru out ur tutorial , but still ve problem with building my first login page..
After I click the submit button..lblmessage2.= become visible which is
"Error Connecting to Database!"
I tried playing around with my connection string but its still the same..
my current connection string
I'm using window authentication...tried several connection string...but i still cannot connect to the db..other then the connection string..others codes are the same as ur tutorial..
I'm new to ASP.net and SQl server,
I'm using VS 2003 and SQL 2005 express edition,
I followed thru out ur tutorial , but still ve problem with building my first login page..
After I click the submit button..lblmessage2.= become visible which is
"Error Connecting to Database!"
I tried playing around with my connection string but its still the same..
my current connection string
<appSettings> <addkey="strConn"value="Data Source=(local);database=fypDB;User id=;Password=;"/> </appSettings>
I'm using window authentication...tried several connection string...but i still cannot connect to the db..other then the connection string..others codes are the same as ur tutorial..
Last edited by Paladine : Jun 17th, 2006 at 11:59 am.
try
<add name="strConn" connectionString="Data Source=P4C800E\SQLEXPRESS;Initial Catalog=pubs;Integrated Security=True" providerName="System.Data.SqlClient" />
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
•
•
Join Date: Jun 2006
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
•
•
•
•
Originally Posted by Paladine
try
<add name="strConn" connectionString="Data Source=P4C800E\SQLEXPRESS;Initial Catalog=pubs;Integrated Security=True" providerName="System.Data.SqlClient" />
I tried the above but error message came out bout missing key, so i replace name with key,..and then another error bout value came out so i replace it,...and now its this error..all this are after the on submit
Parser Error Message: Unrecognized attribute 'providerName'
Source Error:
Line 2: <configuration>
Line 3: <appSettings>
Line 4: <add key="strConn" value="Data Source=SHINGREY2\SQLEXPRESS;database=Northwind;Integrated Security=True" providerName="System.Data.SqlClient"/>
Line 5: </appSettings>Line 6: <system.web>
So your datasource is SQLEXPRESS and not some other name?
Also, you have left left the Database as Northwind, and your previous post showed that your database is fypDB So make sure you taylor the string for you specific instance.
Also, the providerName is not required, that was out of ASP.NET 2.0. My apologies, bu the error message tells you what is wrong, so remove the portion that is unrecognized.
The error will occur on the Submit, because that is when the application makes a call to the Database.
Should be: (at least try this)
<addkey="strConn"value="Data Source=(local);Initial Catalog=fypDB;Integrated Security=True""/>
Also, you have left left the Database as Northwind, and your previous post showed that your database is fypDB So make sure you taylor the string for you specific instance.
Also, the providerName is not required, that was out of ASP.NET 2.0. My apologies, bu the error message tells you what is wrong, so remove the portion that is unrecognized.
The error will occur on the Submit, because that is when the application makes a call to the Database.
Should be: (at least try this)
<addkey="strConn"value="Data Source=(local);Initial Catalog=fypDB;Integrated Security=True""/>
Last edited by Paladine : Jun 17th, 2006 at 1:46 pm.
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Other Threads in the ASP.NET Forum
- Previous Thread: Maintaing filter criteria in main page
- Next Thread: Insert,Update,Delete codings.


Linear Mode