AnthonyJ20
Programmer
Hope someone can help me. I'm having a problem making a connection to an SQL Server database using .Net. This is the error
Server Error in '/WebApplication1' Application.
--------------------------------------------------------------------------------
Compilation Error
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: BC30451: Name 'CustomerBoxes' is not declared.
Source Error:
Line 75:
Line 76: Dim dsProducts As New DataSet
Line 77: cmdProducts.Fill(CustomerBoxes, "tblDataTable")
Line 78:
Line 79: repList.DataSource = _
Source File: c:\inetpub\ Line: 77
I'm somewhat new to SQL Server. I've imported two tables. CustomerBoxes and tblDataTableNew. The two table are related. The tblDataTable DataTableID is related to the CustomerBoxes CustomerID. Can anyone point me in the right direction? Here is what my connection looks like.
Sub Page_Load(Source As Object, E As EventArgs)
' Variable declaration
' Obtain CategoryID from QueryString
Dim DataTable As Integer = _
CInt(Request.Params("DataTable"))
' TO DO: read data from database
Dim strConn As String
Dim conn As SqlConnection
strConn = _
"server=REMITCOCLTVOL;uid=APhillips;pwd=james113;database=RemitcoWebServer"
conn = New SqlConnection(strConn)
Dim cmdProducts As SqlDataAdapter
cmdProducts = _
New SqlDataAdapter("ProductsByCategory", conn)
cmdProducts.SelectCommand.CommandType = _
CommandType.StoredProcedure
Dim paramCategoryID As SqlParameter
paramCategoryID = _
new SqlParameter("@CustomerID", SqlDbType.Int, 4)
paramCategoryID.Value = DataTable
cmdProducts.SelectCommand.Parameters.Add(paramCategoryID)
Dim dsProducts As New DataSet
cmdProducts.Fill(CustomerBoxes, "tblDataTable")
repList.DataSource = _
dsProducts.Tables("tblDataTable").DefaultView
repList.DataBind()
End Sub
Server Error in '/WebApplication1' Application.
--------------------------------------------------------------------------------
Compilation Error
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: BC30451: Name 'CustomerBoxes' is not declared.
Source Error:
Line 75:
Line 76: Dim dsProducts As New DataSet
Line 77: cmdProducts.Fill(CustomerBoxes, "tblDataTable")
Line 78:
Line 79: repList.DataSource = _
Source File: c:\inetpub\ Line: 77
I'm somewhat new to SQL Server. I've imported two tables. CustomerBoxes and tblDataTableNew. The two table are related. The tblDataTable DataTableID is related to the CustomerBoxes CustomerID. Can anyone point me in the right direction? Here is what my connection looks like.
Sub Page_Load(Source As Object, E As EventArgs)
' Variable declaration
' Obtain CategoryID from QueryString
Dim DataTable As Integer = _
CInt(Request.Params("DataTable"))
' TO DO: read data from database
Dim strConn As String
Dim conn As SqlConnection
strConn = _
"server=REMITCOCLTVOL;uid=APhillips;pwd=james113;database=RemitcoWebServer"
conn = New SqlConnection(strConn)
Dim cmdProducts As SqlDataAdapter
cmdProducts = _
New SqlDataAdapter("ProductsByCategory", conn)
cmdProducts.SelectCommand.CommandType = _
CommandType.StoredProcedure
Dim paramCategoryID As SqlParameter
paramCategoryID = _
new SqlParameter("@CustomerID", SqlDbType.Int, 4)
paramCategoryID.Value = DataTable
cmdProducts.SelectCommand.Parameters.Add(paramCategoryID)
Dim dsProducts As New DataSet
cmdProducts.Fill(CustomerBoxes, "tblDataTable")
repList.DataSource = _
dsProducts.Tables("tblDataTable").DefaultView
repList.DataBind()
End Sub