Re: How to use DataReader to retrive data from the database



"Goran" <goran.sutinovski@xxxxxxxxx> wrote in message
news:1132573052.296748.213970@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

> Private objConn As New OleDbConnection("Provider=SQLOLEDB.1;" &

Firstly, why are you using OleDb to connect to SQL Server instead of the
native .NET data provider?

> Dim objCmd As New OleDbCommand( _
> "SELECT * FROM tblEmployee" & _
> "WHERE tblEmployee.Name = @Name AND tblEmployee.Pass =
> @Pass", objConn)

Secondly, try to get into the habit of using stored procedures instead of
dynamic SQL. In this case, are "@Name" and "@Pass" VB.NET variables? If not,
I can't see how this SQL is ever going to work...

Is your DataReader object actually being populated with data?

> So from here I need the PassType so that on login I can compare the
> Name, Password and Password Type.
> I have a login.aspx page for this application. What should I write in
> it so that I can retrive the PassType information from the DataBase
> that I can after compare and eventualy to login.

Well, you could store the PassType in a Session variable; you could pass it
to the login.aspx page as a QueryString variable, or you could fetch it out
of the database in the Page_Load event of the login.aspx page.


.



Relevant Pages

  • Re: Is TDS used only if server is local?
    ... ADO.NET drivers are listed: ... In reference to SQL Server .NET Data Provider, here is what the author says, ... TDS is SQL ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Dot Net 2.0 or SQL Server 2005 problem?
    ... When connecting to SQL Server one should use the SqlClient .NET Data Provider. ... This ConnectionString will not be correct for the Odbc .NET data provider or the Oledb .NET data provider. ... not associated with a trusted SQL Server connection. ... (Incidentally I am running Windows XP Pro and my Windows login id has ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Microsoft SQL Desktop Engine - using
    ... > Or, you could use alternatives to SQL server, like mySql. ... There is an excellent native .NET data provider available from CoreLabs, ... akin to SQL Server Enterprise Manager ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Connect to Sql server using DSN?
    ... Got to use the odbc .net data provider? ... Our application is already using Sql server .net data provider. ... Do you have a sample connection string that utilizes the DSN? ...
    (microsoft.public.dotnet.framework.aspnet.security)