troubleshooting Question

An unhandled exception occurred during the execution of the current web request in ASP.NET

Avatar of redcoder
redcoder asked on
3 Comments1 Solution558 ViewsLast Modified:
I am using WebMatrix to learn some ASP.NET. I have the following code :

        Function ShowSingleRecord(ByVal mySQL As string) As System.Data.IDataReader
        Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=H:\E_Commerce P"& _
        Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString)

        Dim queryString As String = mySQL
        Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
        dbCommand.CommandText = queryString
        dbCommand.Connection = dbConnection

        Dim dataReader As System.Data.IDataReader = dbCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection)

        Return dataReader
    End Function

Sub Button2_Click(sender As Object, e As EventArgs)
dim mycust as integer

Dim thisSQL = "SELECT [Customer].* FROM [Customer] WHERE ([Customer].[CustID] = mycust)"
End Sub

and HTML code :

    <form runat="server">
            Enter Your customer ID here:
            <asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
            <asp:DataGrid id="DataGrid1" runat="server"></asp:DataGrid>
            <asp:Button id="Button2" onclick="Button2_Click" runat="server" Text="Show Record"></asp:Button>
        <!-- Insert content here -->

But receive error :

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: No value given for one or more required parameters.

'and some long description of the error..' What could be the problem ?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros