Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8605103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:44:30+00:00 2026-06-12T02:44:30+00:00

in my form, when i modify data i’m getting error as ‘Command text was

  • 0

in my form, when i modify data i’m getting error as
‘Command text was not set for the command object’

I’m using oledb connection

Following us my code

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click    
Try
        sql = "select * from Employee"
        conn = New OleDbConnection(s)
        adapt = New OleDbDataAdapter(sql, conn)
        ds = New DataSet

        usql = "Update Employee set enp_name=?, emp_addr=?, DOB=?, DOJ=?, emp_mob=?, emp_mail=? where ID=?"
        ucmd = New OleDbCommand(isql, conn)

        Dim date1 As Date
        date1 = DateTimePicker1.Value

        p = ucmd.Parameters.Add("@emp_name", OleDbType.Char)
        p.SourceColumn = "emp_name"
        p.SourceVersion = DataRowVersion.Current

        p = ucmd.Parameters.Add("@emp_addr", OleDbType.Char)
        p.SourceColumn = "emp_addr"
        p.SourceVersion = DataRowVersion.Current

        p = ucmd.Parameters.Add("@DOB", OleDbType.DBDate)
        p.SourceColumn = "DOB"
        p.SourceVersion = DataRowVersion.Current

        p = ucmd.Parameters.Add("@DOJ", OleDbType.DBDate)
        p.SourceColumn = "DOJ"
        p.SourceVersion = DataRowVersion.Current

        p = ucmd.Parameters.Add("@emp_mob", OleDbType.Integer)
        p.SourceColumn = "emp_mob"
        p.SourceVersion = DataRowVersion.Current

        p = ucmd.Parameters.Add("@emp_mail", OleDbType.Char)
        p.SourceColumn = "emp_mail"
        p.SourceVersion = DataRowVersion.Current

        p = ucmd.Parameters.Add("@ID", OleDbType.Integer)
        p.SourceColumn = "ID"
        p.SourceVersion = DataRowVersion.Current

        adapt.UpdateCommand = ucmd

        conn.Open()
        If conn.State = ConnectionState.Open Then
            adapt.MissingSchemaAction = MissingSchemaAction.AddWithKey
            adapt.Fill(ds, "ABC")
            'conn.Close()
        End If

        tables = ds.Tables
        table = tables("ABC")
        rows = table.Rows
        cols = table.Columns

        row = rows.Find(TextBox1.Text)
        row.BeginEdit()
        row("ID") = TextBox1.Text
        row("emp_name") = TextBox2.Text
        row("emp_addr") = TextBox3.Text
        row("DOB") = DateTimePicker1.Text
        row("DOJ") = DateTimePicker2.Text
        row("emp_mob") = TextBox4.Text
        row("emp_mail") = TextBox5.Text
        row.EndEdit()
        'conn.Open()
        adapt.Update(ds, "ABC")** Getting error on this line 
    Catch ex As Exception
        MessageBox.Show(ex.ToString)
    End Try
  End Sub

But i’m not getting where i’m going wrong…. please help me

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T02:44:31+00:00Added an answer on June 12, 2026 at 2:44 am

    You are not setting usql to the ucmd anywhere.

    ucmd.CommandText = usql;
    

    Or rather, in your constuctor:

    ucmd = New OleDbCommand(isql, conn)
    

    isql should probably be usql. I am guessing there is an isql string field in the class if you are not getting compilation errors.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with some fields getting some data using knockout.js (ver. 2.1.0).
I have a dictionary of form data that I want to modify using a
I want to modify a form using javascript (after a user must have clicked
I have a form where users can modify a collection of objects using a
Hello i was trying to modify an object form the values of another object
I'm attempting to override Form.Text in order to modify the Title prior to appearing
Is there an easy-ish way to modify the webform-form-tpl.php template to show disclaimer text
I have a form that I am using to post data to mysql. Before
I'm trying to modify an object on a click. Here's what I have. <form>
Is it possible to modify the form-data content of an HttpRequestMessage in a filter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.