Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Insert Command for DBF

Posted on 2006-06-22
3
Medium Priority
?
346 Views
Last Modified: 2008-02-01
What is wrong with this

            CmdDBf.Connection = CnnDBF
            CmdDBf.CommandType = CommandType.Text

            CmdDBf.CommandText = "INSERT INTO CHQS ( CHCHNO, CHBNNO, TYPE, CHAMNT, CHDATE, CHRCNC ) " & _
                                 "select ?, ?, ?, ?, ?, 0 ;"

            CmdDBf.Parameters.Add(New OleDb.OleDbParameter("@CHCHNO", OleDb.OleDbType.Double))
            CmdDBf.Parameters.Add(New OleDb.OleDbParameter("@CHBNNO", OleDb.OleDbType.Char))
            CmdDBf.Parameters.Add(New OleDb.OleDbParameter("@TYPE", OleDb.OleDbType.Char))
            CmdDBf.Parameters.Add(New OleDb.OleDbParameter("@CHAMNT", OleDb.OleDbType.Double))
            CmdDBf.Parameters.Add(New OleDb.OleDbParameter("@CHDATE", OleDb.OleDbType.Date))


            For Each divRow As DataRow In dsTempDiv.Tables("TempDiv").Rows

                Try
                    Amount = divRow("Amount")
                    HerdNo = divRow("HerdNo")
                    ChequeNo = divRow("ChequeNo")

                    CmdDBf.Parameters.Item("@CHCHNO").Value = ChequeNo
                    CmdDBf.Parameters.Item("@CHBNNO").Value = HerdNo
                    CmdDBf.Parameters.Item("@TYPE").Value = "DIV"
                    CmdDBf.Parameters.Item("@CHAMNT").Value = Amount
                    CmdDBf.Parameters.Item("@CHDATE").Value = Format(Date.Now, "")


                    CmdDBf.ExecuteNonQuery()

at execute it returns
Command is missing required clause

the missing clause is FROM

what can i do there is no table to select from as I am just adding paramaters.





0
Comment
Question by:Eamon
[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
3 Comments
 
LVL 25

Accepted Solution

by:
dstanley9 earned 2000 total points
ID: 16962079

try this:

            CmdDBf.CommandText = "INSERT INTO CHQS ( CHCHNO, CHBNNO, TYPE, CHAMNT, CHDATE, CHRCNC ) " & _
                                 "VALUES (?, ?, ?, ?, ?, 0) ;"
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16963083
If you are going to use Select, then you need to specify the table that the data is coming from:

select ?, ?, ?, ?, ?, 0 From Table1

Bob
0
 
LVL 1

Author Comment

by:Eamon
ID: 16967009
Thanks dstanley9

That did the trick. Had created an insert query in access but it did not have values it just had Select.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

610 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