Hi,
I have problem to update record to database, Dataadapter.update command will not given any error message even that will not update to the read database. I have check with SQL Express database and MS Access database. My coding as follows,
Me.Validate() Me.Table1BindingSource.EndEdit() Me.Table1TableAdapter.Update(Me.Db1DataSet.Table1)I just want to know , Express edition will support database update or inset options. Please help some one to resolve this issue.
Thanks for you help & Have a nice day.
Bala

VB.Net Express Edition will support to add new record to database?
Kossori
animated405
A dataset is a disconnected entity. Adding rows to it will do nothing to your database.
BillyB
Ok. Thanks. Even I've tried following code to insert single row into the database, but this will not help for me any more.
Dim newrow As db1DataSet.Table1Rownewrow = db1DataSet.Table1.NewTable1Row
newrow.test =
"TEST"newrow.test1 =
"TEST12"db1DataSet.Table1.Rows.Add(newrow)
Any Idea about this
brentserbus2
hi,
your first code seems to be fine ,
your second code is fine too ,but as what cgraus said dataset is an object in your memory you have to call "tableAdapter.update" method to update your database, your code just working with the dataset .
may be you looking for data in a wrong database after you update, at the top of this forum there is a FAQ thread, there is a question about why you can't update your database and how to solve this
hope this helps
Duggie
Dear Cgraus,
Thanks for your response. I've followed below link steps to create my sample project.
http://msdn.microsoft.com/vstudio/express/vb/features/data/
After complete everything it is working fine and I get VB output screen. While adding new values is reflected only in the dataset, data will not update into database server. If possible please provide some working example link, thanks in advance.
degia
I don't know of any examples, sorry. The MSDN ones will work, however.
shrek.wang
Yes, it definately supports it. I have no idea how to do it with the newer classes, I prefer to write my own database code. But I'm sure someone will tell you how. Have you googled for examples
Richard Carpenter
That doesn't add rows to the dataset, it is a way of addressing the row and his code is fine.
And he's using the coding methodologies that I so deeply commend.
The problem he is describing has one of two roots. 1.) Either his updating is incorrect or 2.) he is overwriting his database (and I hope this is an Access discussion or I'm out to sea).
Here is the solution for 1.)
Public Function PersistTable(ByVal Table As DataTable, Optional ByVal NewRow As DataRow = Nothing) As Boolean
' adodb.PersistTable - called by any routine needing to make permanent changes in a table.
' Usually this would be midlevel procedures in IOSUBS
' PersistTable has an optional argument for appending a new row on a table.
Adapter.SelectCommand = New OleDbCommand("Select * from [" & Table.TableName & "]", con)
Dim builder As New OleDbCommandBuilder(Adapter)
builder.QuotePrefix = "["
builder.QuoteSuffix = "]"
If NewRow IsNot Nothing Then
NewRow.Item(DataRecords.ciRecordNo) = Table.Rows.Count
Table.Rows.Add(NewRow)
End If
Try
Adapter.Update(Table)
Catch e As Exception
'Throw e
MsgBox("Error persisting Table: " + Table.TableName + vbCrLf + "Exception was: " + e.Message, _
MsgBoxStyle.Information, "ADONET.PersistTable")
End Try
End Function
The solution for two in VBE... is to put your database somewhere outside of the bin directories and to modify your connection string to reflect its location.
Good luck!