G
Guest
Please Im getting the above error due to running code below from .aspx.vb form.
Ive taken out some code below to simplify this question.
Partial Class Process_Master
Inherits System.Web.UI.Page
Protected Sub lst_Employees_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles lst_Employees.SelectedIndexChanged
Dim strConn As String =
"server=companyserver;database=CompanyDB;Trusted_Connection=yes"
Dim sql As String = "Select * from tbl_Master"
Dim conn As New SQLConnection(strConn)
Dim objDR As SQLDataReader
Dim Cmd As New SQLCommand(sql, conn)
conn.Open()
objDR = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
Page.DataBind()
End Sub
End Class
I know most likely its missing the namespace shown below but whereever I put
this namespace I error out. In an original webform the code above is within
..aspx instead of separated out and it works. Im now separating out these
events from .aspx and am running into this "SQL" error.
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQLClient" %>
thanks for any assistance.
Ive taken out some code below to simplify this question.
Partial Class Process_Master
Inherits System.Web.UI.Page
Protected Sub lst_Employees_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles lst_Employees.SelectedIndexChanged
Dim strConn As String =
"server=companyserver;database=CompanyDB;Trusted_Connection=yes"
Dim sql As String = "Select * from tbl_Master"
Dim conn As New SQLConnection(strConn)
Dim objDR As SQLDataReader
Dim Cmd As New SQLCommand(sql, conn)
conn.Open()
objDR = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
Page.DataBind()
End Sub
End Class
I know most likely its missing the namespace shown below but whereever I put
this namespace I error out. In an original webform the code above is within
..aspx instead of separated out and it works. Im now separating out these
events from .aspx and am running into this "SQL" error.
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQLClient" %>
thanks for any assistance.