Data Reader

Results 1 to 2 of 2

Thread: Data Reader

  1. #1
    Join Date
    Dec 1969

    Default Data Reader

    I am trying to use a data reader but get the following error. Cna anyone help.<BR><BR>Compiler Error Message: BC30390: &#039;System.Data.SqlClient.SqlDataReader.Priva te Overloads Sub New(command As System.Data.SqlClient.SqlCommand)&#039; is not accessible in this context because it is &#039;Private&#039;.<BR><BR><BR>Sub Button1_Click(sender As Object, e As EventArgs)<BR> Dim Username = Request.Form("txtUser")<BR> Dim Password = Request.Form("txtPass")<BR> <BR> Dim strSql as String<BR> strSql = "Select * From Security Where Username = &#039;"+ Username +"&#039;"<BR> strSql += "And Password = &#039;"+ Password + "&#039;"<BR> <BR> Dim strConnection as String = "server=Sigma3;database=IVR;uid=sa;password=;" <BR> <BR> Dim strResult as String<BR> <BR> Dim objConnection As New SqlConnection(strConnection)<BR> <BR> Dim objCommand As New SqlCommand(strSql, objConnection)<BR> <BR> Dim objDataReader As New SqlDataReader<BR> <BR> objDataReader = objCommand.ExecuteReader()<BR> <BR> <BR> &#039;If objDataReader.Read()=True Then<BR> If objDataReader Is Nothing Then<BR> Response.Redirect("")<BR> Else<BR> Label1.Text = "Sorry Invalid Username or Password "<BR> <BR> End Sub<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Data Reader

    Don&#039;t use the word "New"<BR>--<BR><BR>Dim objDataReader As SqlDataReader<BR><BR>objDataReader = objCommand.ExecuteReader()<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts