No there is no post back.
I have a create dataset function
Dim objConnection As New System.Data.SqlClient.SqlConnection(StrConnection)
objDataAdapter = New System.Data.SqlClient.SqlDataAdapter(StrSQL,
objConnection)
objBuilder = New SqlClient.SqlCommandBuilder(objDataAdapter)
objDataAdapter.UpdateCommand = objBuilder.GetUpdateCommand()
objDataAdapter.InsertCommand = objBuilder.GetInsertCommand()
objDataAdapter.DeleteCommand = objBuilder.GetDeleteCommand()
objDataAdapter.Fill(objDataSet,0)
return objDataSet
end function
I call it in a sub (called from the render controls in a custom control)
Dim objds as new Dataset()
objds = CreateDataSet(strConnection,strSQL)
In the render sub
I try
objds.tables(0).rows(0)(fieldname)
I get the error. The only way around it is to recreste the dataset. Anyideas
where I am going wrong.
"Daniel Walzenbach" <da***************@newsgroup.nospam> wrote in message
news:#q**************@TK2MSFTNGP10.phx.gbl...
Chris,
does your dataset contain a table(0) in Sub1? And is sub2 called directly
after sub1 fires? Do you have a postback between accessing sub1 and sub2?
If so your variables are lost. If you want to prevent varibales between
postbacks you have to store them in viewstate, sessionstate or cache or
whatever fits your need.
Daniel
"Chris Kennedy" <ck**************@bleyonder.co.uk> schrieb im Newsbeitrag
news:eZ**************@tk2msftngp13.phx.gbl...I have a dataset, datatable and data row which I have declared public in
my class. I instantiate them in one sub routine and go to use them again
and I
get an 'Cannot find table 0' wrror
Public objds as new dataset()
Public objDataTable As new DataTable()
Public objRow As DataRow
Sub 1
Create dataset and use sucessfully
end sub
Sub 2
objds.tables(0).rows(0)(XMLItem("fieldname"))
End sub