Solved

the type sqlcommandbuilder is not deffined

Posted on 2007-11-21
2
508 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 63

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
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.

752 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