Hello and thank you for taking a moment to read this message. I am new to ASP.NET and am trying to write a search page that queries the Northwind Database. When I go to run my application, I hit the submit button( this would run my query) I get error below. Also below is my code-behind for the application. If anybody has any suggestions, I would be extremely grateful. Thank you- Jason
Line 1: Incorrect syntax near 'usp_Find_Orders'.
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.SqlClient.SqlException: Line 1: Incorrect syntax near 'usp_Find_Orders'.
Source Error:
Line 43:
Line 44: objConn.Open()
Line 45: dgrdOrders.DataSource = objCommand.ExecuteReader()
Line 46: dgrdOrders.DataBind()
Line 47: objConn.Close()
Source File: C:\Documents and Settings\Jason Livengood\My Documents\Visual Studio 2005\WebSites\WebSite3\Default.aspx.
vb Line: 45
---------------------------------------------------------------------Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Sub Submit(ByVal Source As Object, ByVal E As EventArgs) Handles btnSearch.Click
If txtOrderNumber.Text Is DBNull.Value Then
txtOrderNumber.Text = "10248"
End If
If txtProductName.Text Is DBNull.Value Then
txtProductName.Text = "Queso Cabrales"
End If
If txtShippedDate.Text Is DBNull.Value Then
txtShippedDate.Text = "7/16/1996"
End If
If txtpersonshippedto.Text Is DBNull.Value Then
txtpersonshippedto.Text = "Vins et alcools Chevalier"
End If
Dim strConn As String = ConfigurationManager.AppSettings("NWind")
Dim objConn As New Data.SqlClient.SqlConnection(strConn)
Dim objCommand As New Data.SqlClient.SqlCommand("usp_Find_Orders", objConn)
objCommand.Parameters.AddWithValue("@OrderID", txtOrderNumber.Text)
objCommand.Parameters.AddWithValue("@ProductName", txtProductName.Text)
objCommand.Parameters.AddWithValue("@ShippedDate", txtShippedDate.Text)
objCommand.Parameters.AddWithValue("@ShipName", txtpersonshippedto.Text)
objConn.Open()
dgrdOrders.DataSource = objCommand.ExecuteReader()
dgrdOrders.DataBind()
objConn.Close()
End Sub
End Class