Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DataAdapter Example
Message
De
28/12/2004 18:05:11
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00972709
Message ID:
00972741
Vues:
11
>Not sure why this insert doesn't work. It doesn't error at all,
>yet I get no new record into the products table.
>
>
>Imports System.Data.OleDb
>
>Module VFPStuff
>
>    Public Sub VFP1()
>
>        Dim connStr As String = "Provider=VFPOLEDB.1;Data Source=" & _
>                                "c:\program files\microsoft\vfp8\samples\data\testdata.dbc"
>        Dim strSQL As String = "SELECT * FROM Products"
>        Dim oda As New OleDbDataAdapter(strSQL, connStr)
>        Dim cmdInsert As New OleDbCommand("INSERT INTO Products " & _
>                                 "(product_id, prod_name) VALUES ('KEV1','Kevin1')")
>
>        oda.InsertCommand = cmdInsert
>
>        MsgBox("Inserted")
>
>    End Sub
>
>End Module
>
Kevin,
As I remember there are fields in that table not allowing nulls. Set null off first.

New OleDbCommand("set null off") and ExecuteNonQuery() (for this one and for insert).
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform