Solved

the type sqlcommandbuilder is not deffined

Posted on 2007-11-21
2
506 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:
Ted Bouskill earned 500 total points
ID: 20330667
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
ID: 20330766
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 is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

777 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