Hmmm.... It makes sense to me that the table would have to be included, but
it still does the same thing. Per Cors comment, it looks like there may not
be anything to update cause when using his code it doesnt fill the dataset
again... I dont understand why though, cause I AM making a change to the
datagrid.... Any ideas??
"james" wrote:
> I see where you are telling the DataAdaptor to Update: daGifts.Update(DsGifts1) < I'm assuming DsGifts1 is your Dataset>
> But, you are not telling it which Table to update: daGifts.Update(DsGifts1,"tblGifts") < and I assume that tblGifts is the
> table you want to update.>
> That appears to me to be the problem. Although, I would think it would throw an error if you doin't specify the table to apply
> the update to.
> james
>
> "Brett" <(E-Mail Removed)> wrote in message news:4BAEB06E-4FE1-47C5-90F1-(E-Mail Removed)...
> > Not sure what the problem is here... Trying to update from a datagrid to an
> > access database using vb.net... Its not updating the database but Im not
> > getting any errors... Here is my code...
> >
> > 'OleDbUpdateCommand1
> >
> > Me.OleDbUpdateCommand1.CommandText = "UPDATE tblGifts SET gift = ?,
> > name = ?, purchased = ? WHERE (autonum = ?) AND (gi" & _
> > "ft = ? OR ? IS NULL AND gift IS NULL) AND (name = ? OR ? IS NULL
> > AND name IS NUL" & _
> > "L) AND (purchased = ?)"
> > Me.OleDbUpdateCommand1.Connection = Me.OleDbConnection1
> > Me.OleDbUpdateCommand1.Parameters.Add(New
> > System.Data.OleDb.OleDbParameter("gift",
> > System.Data.OleDb.OleDbType.VarWChar, 50, "gift"))
> > Me.OleDbUpdateCommand1.Parameters.Add(New
> > System.Data.OleDb.OleDbParameter("name",
> > System.Data.OleDb.OleDbType.VarWChar, 50, "name"))
> > Me.OleDbUpdateCommand1.Parameters.Add(New
> > System.Data.OleDb.OleDbParameter("purchased",
> > System.Data.OleDb.OleDbType.Boolean, 2, "purchased"))
> > Me.OleDbUpdateCommand1.Parameters.Add(New
> > System.Data.OleDb.OleDbParameter("Original_autonum",
> > System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input,
> > False, CType(0, Byte), CType(0, Byte), "autonum",
> > System.Data.DataRowVersion.Original, Nothing))
> > Me.OleDbUpdateCommand1.Parameters.Add(New
> > System.Data.OleDb.OleDbParameter("Original_gift",
> > System.Data.OleDb.OleDbType.VarWChar, 50,
> > System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
> > "gift", System.Data.DataRowVersion.Original, Nothing))
> > Me.OleDbUpdateCommand1.Parameters.Add(New
> > System.Data.OleDb.OleDbParameter("Original_gift1",
> > System.Data.OleDb.OleDbType.VarWChar, 50,
> > System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
> > "gift", System.Data.DataRowVersion.Original, Nothing))
> > Me.OleDbUpdateCommand1.Parameters.Add(New
> > System.Data.OleDb.OleDbParameter("Original_name",
> > System.Data.OleDb.OleDbType.VarWChar, 50,
> > System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
> > "name", System.Data.DataRowVersion.Original, Nothing))
> > Me.OleDbUpdateCommand1.Parameters.Add(New
> > System.Data.OleDb.OleDbParameter("Original_name1",
> > System.Data.OleDb.OleDbType.VarWChar, 50,
> > System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
> > "name", System.Data.DataRowVersion.Original, Nothing))
> > Me.OleDbUpdateCommand1.Parameters.Add(New
> > System.Data.OleDb.OleDbParameter("Original_purchased",
> > System.Data.OleDb.OleDbType.Boolean, 2, System.Data.ParameterDirection.Input,
> > False, CType(0, Byte), CType(0, Byte), "purchased",
> > System.Data.DataRowVersion.Original, Nothing))
> >
> > --------------------------------------------------------------------------
> >
> > Sub dgGifts_Update(ByVal sender As Object, ByVal e As
> > DataGridCommandEventArgs)
> > Dim ckPurchased As CheckBox = CType(e.Item.FindControl("CheckBox1"),
> > CheckBox)
> > Me.OleDbConnection1.Open()
> > daGifts.Update(DsGifts1)
> > Me.OleDbConnection1.Close()
> > dgGifts.EditItemIndex = -1
> > daGifts.Fill(DsGifts1)
> > dgGifts.DataBind()
> > End Sub
> >
> > --------------------------------------------------------
> >
> > Any help would be appreciated... Thanks :-)
> > -Brett
>
>
>