2. Create the Code Behind (C#)
- One thing to note here, you use the keyword using instead of import to "import/include" the namespaces you require for security, data access, etc.
- Also note how clean and short the code structure is when comparing VB.Net to C#. Now in my opinion, I love VB.Net far more than C# or C++, as I find it more intuitive, but each to his own.

3. Add the following line to the Web.Config file to enable DB access
- Notice that this is no different than the one used in the VB.Net Example- I have removed my login info from the strConn, don't forget to add yours in place!

Why are you converting an int value to a string and comparing it to a string int?
- Sorry i'm poor experience about c# programing so some time i've got a mistake. :s

I am just learning ASP.NET and I am trying to build an ASP.Net login page. Before that i've got an error '('Login.WebForm1.DBConnection(string, string)' and than i try to chage '(string)objReader.GetValue(0) != "1"' to 'objReader.GetValue(0) = 0' error is 'Cannot implicitly convert type 'object' to 'bool' and 'The left-hand side of an assignment must be a variable, property or indexer'
Do you have any idea?

now i see where im getting hung up at. i can understand the code pretty well but i cant figure out why my stored procedure is telling me that the @username and @password is invalid columns, i thought thats where it does the match from the entered data.
SELECT COUNT(*) AS Num_of_User
FROM tblUser
WHERE (((tblUser.U_Name)=[@UserName]) AND ((tblUser.U_Password)=[@Password]));

OK a don't see anything wrong with your code, what version of SQL server are you using? Microsoft Recommends that if you have version 7.0 or later (includes MSDE) the SqlClient should be used.

But also inorder to use OleDB you need to consider this: The .NET Framework Data Provider for OLE DB requires the installation of MDAC 2.6 or later.

Not sure if that helps much, but have you tried making any other connections to the SQL Server using OleDb? Also, have you tried removing the using System.Data.SqlClient and recompiling and see what happens? I know it sounds strange and too simplistic, but stranger things have happened that can make an application run.

Hope this helps.

P.S. When does this error occur? OnCompile? Provide as much details as you can on the sequence that generates this message.
:cool: :cool: :cool: