Compiler Error: '1-dimensional array of System.Data.OleDb.OleDbDataReader'.

G

Ginola

Hi, I have encountered this error message

Dim ConnStr As String
Dim strPwd as String
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;"
ConnStr &= "Data Source=C:\stock\currentForm.mdb;"
Dim myOleDbConn As New OleDbConnection(ConnStr)
myOleDbConn.Open
Dim SQL As String = "SELECT LoginName,Pwd FROM Login where
LoginName='" & struser & "'"
Dim myOleDbCmd as New OleDbCommand(SQL, myOleDbConn)
Dim myReader As OleDbDataReader()
myReader = myOleDbCmd.ExecuteReader()

I got a error message
Compiler Error Message: BC30311: Value of type
'System.Data.OleDb.OleDbDataReader' cannot be converted to
'1-dimensional array of System.Data.OleDb.OleDbDataReader'.
in this line
myReader = myOleDbCmd.ExecuteReader()
or
myReader = myOleDbCmd.ExecuteReader

I also search in Google which only has three links related to this.
I also try the same files to two different computer. Same error
appears.

I just wonder if anyone has the same problem before?

Thanks

P.S. The source code and error message are loacted at the bottom of
this email if you are interested.


**************Errror message
********************************************
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.

Compiler Error Message: BC30311: Value of type
'System.Data.OleDb.OleDbDataReader' cannot be converted to
'1-dimensional array of System.Data.OleDb.OleDbDataReader'.

Source Error:

Line 21: Dim myOleDbCmd as New OleDbCommand(SQL, myOleDbConn)
Line 22: Dim myReader As OleDbDataReader()
Line 23: myReader = myOleDbCmd.ExecuteReader
Line 24: ' strPwd = myReader.GetString(2)
Line 25: strPwd = "testing"


**************Source Code ********************************************

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data.OleDb " %>
<%@ Import Namespace="System.Data " %>
<%@ Import Namespace="System.Web.Security " %>

<html>
<head>
<script runat="server">

Sub Page_Load(sender As Object, e As EventArgs)
End Sub

Function GetPwd( strUser as string ) as string
Dim ConnStr As String
Dim strPwd as String
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;"
ConnStr &= "Data Source=C:\stock\currentForm.mdb;"
Dim myOleDbConn As New OleDbConnection(ConnStr)
myOleDbConn.Open
Dim SQL As String = "SELECT LoginName,Pwd FROM Login where
LoginName='" & struser & "'"
Dim myOleDbCmd as New OleDbCommand(SQL, myOleDbConn)
Dim myReader As OleDbDataReader()
myReader = myOleDbCmd.ExecuteReader
' strPwd = myReader.GetString(2)
strPwd = "testing"
GetPwd = strPwd

End Function

Sub Login_Click(Src As Object, E As EventArgs)
'NOTE: The user name and password are stored below for
' the sake of simplicity for our example. In production code,
' these values would be pulled from a database, Active
' Directory, or some other secure location.
If getPwd( username.value ) = password.value Then
Session("user")="tom"

FormsAuthentication.RedirectFromLoginPage(Username.Value, _
true)
Else
Message.Text = "Incorrect Username or Password: Try
again."
End If
End Sub
</script>
</head>
<body>
<form runat="server">
<table>
<tr>
<td>Username:</td>
<td>
<input id="UserName" type="text" runat="server" />
</td>
</tr>
<tr>
<td>Password:</td>
<td>
<input id="Password" type="password" runat="server" />
</td>
</tr>
<tr>
<td>
<asp:button id="login" text="Login"
OnClick="Login_Click" runat="server" />
</td>
<td>
<input type="reset" text="Reset Form" runat="server">
</td>
</tr>
</table>
<asp:Label id="Message" ForeColor="red" runat="server" />
</form>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top