Solved

the type sqlcommandbuilder is not deffined

Posted on 2007-11-21
2
497 Views
Last Modified: 2012-06-27
hi you guys
Im brand new at visual 2003
how i need to define sqlcommandbuilder in this code?
**********************
 Dim myBuilder As SqlCommandBuilder = New SqlCommandBuilder(OleDbDataAdapter1)

        myBuilder.GetUpdateCommand()

        OleDbDataAdapter1.UpdateCommand = myBuilder.GetUpdateCommand()

        OleDbDataAdapter1.Update(objjsm, "jsmfiles")
****************************************************
0
Comment
Question by:edo60
2 Comments
 
LVL 51

Accepted Solution

by:
tedbilly earned 500 total points
Comment Utility
Are you including the namespace System.Data.SqlClient?

Also, you will get MUCH better performance if you use the SqlDataAdapter instead of the OleDbDataAdapter which is generic and slow.
0
 
LVL 62

Expert Comment

by:Fernando Soto
Comment Utility
Hi edo60;

You do not waht to mix OleDb objects with SQL object. The following sample code doest what you need with a Contacts Database so that you have something to work with.

        Dim conn As New OleDbConnection("Server=localhost; Provider=SQLOLEDB; Initial Catalog=Contacts;" _
            & "Integrated Security=SSPI")
        Dim da As New OleDbDataAdapter
        da.SelectCommand = New OleDbCommand("SELECT * FROM Contacts", conn)
        Dim myBuilder As OleDbCommandBuilder = New OleDbCommandBuilder(da)
        Dim ds As New DataSet
        da.Fill(ds, "Contacts")

        ' Add, Update Datatable here and then do your Update.
        da.Update(ds, "Contacts")

Fernando
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how the fundamental information of how to create a table.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now