So, do you have any suggestions about where and what changes to make ?
On Mon, Sep 15, 2008 at 9:55 PM, Cerebrus <[EMAIL PROTECTED]> wrote:
>
> The error message is self-explanatory. You should use your own Update
> statement rather than relying on the CommandBuilder which requires
> Primary Key information based on the Select statement you provide.
>
> On Sep 14, 10:59 pm, Vivek Vorani <[EMAIL PROTECTED]> wrote:
> > Guys, I'm getting the an error which is typed below...Can anyone
> > please tell me why is it so ?
> >
> > Dynamic SQL generation for the Update command is not supported against
> > a SelectCommand that does not return any key columns information.
> >
> > And here's the code:
> >
> > con.Open()
> > sql = "SELECT * FROM sim_data"
> > da = New OleDb.OleDbDataAdapter(sql, con)
> > cb = New OleDb.OleDbCommandBuilder(da)
> > da.Fill(ds, "sim_data")
> > Dim i As Integer
> > For i = 0 To ds.Tables("sim_data").Rows.Count - 1
> > If ds.Tables("sim_data").Rows(i).Item("mdn_no") =
> > combo_mdn.SelectedItem Then
> > ds.Tables("sim_data").Rows(i).Item("sale_inv_no")
> > = txt_inv_no.Text
> >
> > ds.Tables("sim_data").Rows(i).Item("sale_inv_date") =
> > DateTimePicker1.Value
> > ds.Tables("sim_data").Rows(i).Item("dealer_sold")
> > = combo_dealer.SelectedItem
> > ds.Tables("sim_data").Rows(i).Item("status") =
> > "inactive"
> > da.Update(ds, "sim_data")
> > End If
> > Next
> >
> > MsgBox("SIM card sold to Dealer " &
> > combo_dealer.SelectedItem & " successfully.")
> >
> > sql = "SELECT * FROM availability"
> > da = New OleDb.OleDbDataAdapter(sql, con)
> > cb = New OleDb.OleDbCommandBuilder(da)
> > da.Fill(ds, "availability")
> > ds.Tables("availability").Rows(0).Item("sim") =
> > ds.Tables("availability").Rows(0).Item("sim") - 1
> >
> > con.Close()
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---