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 8524037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:34:41+00:00 2026-06-11T07:34:41+00:00

i am using the following code to create to save my DataTable content to

  • 0

i am using the following code to create to save my DataTable content to and empty mdb database, so first i create the datata table and when i try to insert data i get the following error: no value given for one or more parameter, now i think this error is caused by the use of Text as mentioned in this link

but i am not sure how to fix it, here is the code and i get the exception in the commented line

Dim cmd = cnn.CreateCommand
                cmd.CommandText = "CREATE TABLE productstable(supplierid Integer ,catalogid Integer ,ccode Text ,cname Text,pother2 Text, pother3 Double, cprice Double, rank Integer, rankchange Integer , PD Double, PDP Double , TPD Double, TPDP Double, sprice Double, msprice Double, minprice Double, sopriceDB Double, pother4 Long, usedsuppliermargin Double, cimageurl Text, ccategory Integer, pricetaggroup Byte , spricemargingroup Byte)"
                cmd.ExecuteNonQuery()

                Dim ocmd As New OleDbCommand("INSERT INTO productstable(supplierid , catalogid, ccode,cname,pother2,pother3,cprice,rank,rankchange,PD,PDP,TPD,TPDP,sprice,msprice,minprice,sopriceDB,pother4,usedsuppliermargin,cimageurl,ccategory,pricetaggroup,spricemargingroup) VALUES (@supplierid , @catalogid, @ccode, @cname, @pother2, @pother3, @cprice, @rank, @rankchange, @PD, @PDP, @TPD, @TPDP, @sprice, @msprice, @minprice, @sopriceDB, @pother4, @usedsuppliermargin,@cimageurl,@ccategory,@pricetaggroup,@spricemargingroup)", cnn)

                For i = 0 To mainDatatable.Rows.Count - 1
                    ocmd.Parameters.Add(New OleDbParameter("@supplierid", mainDatatable.Rows(i)("supplierid")))
                    ocmd.Parameters.Add(New OleDbParameter("@catalogid", mainDatatable.Rows(i)("catalogid")))
                    ocmd.Parameters.Add(New OleDbParameter("@ccode", mainDatatable.Rows(i)("ccode")))
                    ocmd.Parameters.Add(New OleDbParameter("@cname", mainDatatable.Rows(i)("cname")))
                    ocmd.Parameters.Add(New OleDbParameter("@pother2", mainDatatable.Rows(i)("pother2")))
                    ocmd.Parameters.Add(New OleDbParameter("@pother3", mainDatatable.Rows(i)("pother3")))
                    ocmd.Parameters.Add(New OleDbParameter("@cprice", mainDatatable.Rows(i)("cprice")))
                    ocmd.Parameters.Add(New OleDbParameter("@rank", mainDatatable.Rows(i)("rank")))
                    ocmd.Parameters.Add(New OleDbParameter("@rankchange", mainDatatable.Rows(i)("rankchange")))
                    ocmd.Parameters.Add(New OleDbParameter("@PD", mainDatatable.Rows(i)("PD")))
                    ocmd.Parameters.Add(New OleDbParameter("@PDP", mainDatatable.Rows(i)("PDP")))
                    ocmd.Parameters.Add(New OleDbParameter("@TPD", mainDatatable.Rows(i)("TPD")))
                    ocmd.Parameters.Add(New OleDbParameter("@TPDP", mainDatatable.Rows(i)("TPDP")))
                    ocmd.Parameters.Add(New OleDbParameter("@sprice", mainDatatable.Rows(i)("sprice")))
                    ocmd.Parameters.Add(New OleDbParameter("@msprice", mainDatatable.Rows(i)("msprice")))
                    ocmd.Parameters.Add(New OleDbParameter("@minprice", mainDatatable.Rows(i)("minprice")))
                    ocmd.Parameters.Add(New OleDbParameter("@sopriceDP", mainDatatable.Rows(i)("sopriceDP")))
                    ocmd.Parameters.Add(New OleDbParameter("@pother4", mainDatatable.Rows(i)("pother4")))
                    ocmd.Parameters.Add(New OleDbParameter("@usedsuppliermargin", mainDatatable.Rows(i)("usedsuppliermargin")))
                    ocmd.Parameters.Add(New OleDbParameter("@cimageurl", mainDatatable.Rows(i)("cimageurl")))
                    ocmd.Parameters.Add(New OleDbParameter("@ccategory", mainDatatable.Rows(i)("ccategory")))
                    ocmd.Parameters.Add(New OleDbParameter("@pricetaggroup", mainDatatable.Rows(i)("pricetaggroup")))
                    ocmd.Parameters.Add(New OleDbParameter("@spricemargingroup", mainDatatable.Rows(i)("spricemargingroup")))

                    ocmd.ExecuteNonQuery()
                    ocmd.Parameters.Clear()

                Next
  • 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-11T07:34:43+00:00Added an answer on June 11, 2026 at 7:34 am

    It should be the ocmd that you have to add parameters and not the cmd.

    ocmd.Parameters.Add(New OleDbParameter("@s....
    

    and one more thing, you have to clear the parameters after the ExecuteNonQuery

    For i = 0 To mainDatatable.Rows.Count - 1
        ocmd.Parameters.Add(New OleDbParameter("@s....
        ....
    
        ocmd.ExecuteNonQuery()
        ocmd.Parameters.Clear()
    Next
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following code to create new wifi access point and to connect
I'using the following code to create thumbnails using ffmpeg but it was working fine
I'm using the following code to create an audit trail in an MVC3 app.
I've been using the following code to create various struct, but only give people
I am running following code to create bmp image from pdf using Ghost4j i
I am using the following line of code to create a dictionary which stores
I'm using the following lines of code in my .htaccess file to create redirects.
Okay, so I've got the following code shown below to create a dialog using
Suppose I have the following: using(var ctx = DataContextFactory.Create(0)) { ... Some code ...
I'm using the following code to create an event, and display a popup asking

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.