you don't have an update statement is a start
what condition(s) are you wanting to update the table on?
I would also recommend using a stored procedure rather than an inline
select/update statement.


On Thu, Aug 5, 2010 at 11:45 AM, Markei54545 <[email protected]>wrote:

> I have done the following code to update a SQL database. It reads the
> data fine but try as I might I can't get it to update the database. It
> just doesn't do anything, no errors.
>
> Any ideas? Any help gratefully received.
>
>        Dim ConnString2 As String
>        Dim SQLString2 As String
>
>        ConnString2 = "Driver={SQL
>
> Server};Server=SC000511\SQLEXPRESSR2;Trusted_Connection=Yes;Database=Belvoir;"
>
>        SQLString2 = "SELECT * FROM stockItem "
>
>        Dim cn2 As New Data.Odbc.OdbcConnection(ConnString2)
>        Dim cmd2 As New Data.Odbc.OdbcCommand(SQLString2, cn2)
>        Dim da2 As New Data.Odbc.OdbcDataAdapter(cmd2)
>        Dim ds2 As New Data.DataSet
>        da2.Fill(ds2)
>
>        Dim dr2 As DataRow
>
>        For Each dr2 In ds2.Tables(0).Rows
>
>            dr2("Name") = "TEST"
>
>        Next
>        ds2.Tables(0).AcceptChanges()

Reply via email to