Hi;
I try to get informations from an Access DB. There is tabcontrol. There are some tabstops. If you enter a tabstop it tries to update data in Datagridview. But at the first time you enter to tabstop it normally takes data from database. If you try to take data for a second time you need to do this:
VB Code:
Me.DGW.DataSource = Nothing DS.Tables.Clear() DS.DataSetName = "NewDataSet" CN.Close() CNConnect() RS.Open("SELECT * FROM " & TbStok & Ek, CN, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic) TakeData() ShowData()
and in this function I get the error, which is written in the title:
But I clear the tables b4 using takedata function. There was a table with the same name from first taking data but in a second time I clear it b4 taking data again. What shall I do?VB Code:
Private Function TakeData() As Boolean DS.Tables.Add(TbStok) OL.Fill(DS.Tables(TbStok), RS) DS.DataSetName = CN.ConnectionString DGW.DataSource = DS.Tables(TbStok) Return True End Function




Reply With Quote