Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataAdapter Example
Message
From
28/12/2004 18:05:11
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00972709
Message ID:
00972741
Views:
10
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform