elianeasmar
Well-known member
- Joined
- Oct 3, 2013
- Messages
- 76
- Programming Experience
- Beginner
Hello. I need to get data into dataview (to loop through the rows in the dataview) from my dataset(after making some changing some records:insert, update, insert).
So i need an answer on these two questions:
Can i get data from dataadapter into dataview ? Or i have to get data from dataadapter into dataset then from dataset to dataview(If it's possible)
I have tried something like this:
And i am getting this error:
On this line:
So i need an answer on these two questions:
Can i get data from dataadapter into dataview ? Or i have to get data from dataadapter into dataset then from dataset to dataview(If it's possible)
I have tried something like this:
Dim strconnection As String = "Data Source=EASMAR-PC;Initial Catalog=Database Connection;Integrated Security=True;" _cn = New SqlConnection(strconnection) _cn.Open() cmd.Connection = _cn 'Get the data from database into dataadapter _DataAdapter.SelectCommand = New SqlCommand("SELECT * FROM tblCustomer", _cn) 'Fill the dataset from dataadapter _DataAdapter.Fill(_DataSet) Dim dt As New DataTable dt = _DataSet.Tables("tblCustomer") 'dt contain nothing!! '_DataAdapter.Fill(dt) Debug.WriteLine(dt.Rows.Count.ToString)
And i am getting this error:
Object reference not set to an instance of an object.
On this line:
Debug.WriteLine(dt.Rows.Count.ToString)
Last edited: