C
cmhavoc
Can someone please look at my code and tell me what I might be doing
wrong? I'm getting the following error:
Exception Details: System.NullReferenceException: Object reference
not set to an instance of an object.
for the line with "cmdCat.CommandTimeout = 300"
How can I set the commandTimeout?
See my code below
------------------------------------------------
sub page_load(sender as Object, e as EventArgs)
Dim sqlcon As New
System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("CONNECTION_STRING"))
Dim cmdCat As System.Data.SqlClient.SqlCommand
cmdCat.CommandTimeout = 300
Dim daCat As System.Data.SqlClient.SqlDataAdapter
Dim dsCat1 As New System.Data.DataSet
Dim strCat as String = "SELECT GOES HERE"
daCat = New System.Data.SqlClient.SqlDataAdapter(strCat, sqlcon)
sqlcon.Open()
daCat.Fill(dsCat1)
sqlcon.Close()
rptEmails.DataSource = dsCat1
rptEmails.DataBind()
Page.DataBind()
end sub
wrong? I'm getting the following error:
Exception Details: System.NullReferenceException: Object reference
not set to an instance of an object.
for the line with "cmdCat.CommandTimeout = 300"
How can I set the commandTimeout?
See my code below
------------------------------------------------
sub page_load(sender as Object, e as EventArgs)
Dim sqlcon As New
System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("CONNECTION_STRING"))
Dim cmdCat As System.Data.SqlClient.SqlCommand
cmdCat.CommandTimeout = 300
Dim daCat As System.Data.SqlClient.SqlDataAdapter
Dim dsCat1 As New System.Data.DataSet
Dim strCat as String = "SELECT GOES HERE"
daCat = New System.Data.SqlClient.SqlDataAdapter(strCat, sqlcon)
sqlcon.Open()
daCat.Fill(dsCat1)
sqlcon.Close()
rptEmails.DataSource = dsCat1
rptEmails.DataBind()
Page.DataBind()
end sub