Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

"No value given for one or more required parameters."

 

This is the error I get on the .Fill line of this code.

 

       'Select Command
       Dim txtSelectCommand As String
       txtSelectCommand = "SELECT Customers.CustomerID, Parts.PartID, Parts.Description, " & _
                          "LineItems.Quanity, LineItems.QuantityComplete, " & _
                          "LineItems.DueDate FROM Customers, Parts, " & _
                          "LineItems WHERE LineItems.QuantityComplete < LineItems.Quanity"

       'Set connection and create DataAdapter and DataSet
       Dim dbConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=""Manufacturing Manager.mdb""")
       Dim daPendingSales As New OleDbDataAdapter(txtSelectCommand, dbConnection)
       Dim dsPendingSales As New DataSet("dsPendingSales")

       'Fill the DataSet
       daPendingSales.Fill(dsPendingSales)

       'Set the grids DataBinding
       Me.gridPendingSales.SetDataBinding(dsPendingSales, "ProductOrders")
       Me.gridPendingSales.RetrieveStructure(True)
       Me.gridPendingSales.Refetch()

       'Close Connection
       dbConnection.Close()

 

Any idea what is wrong? I'm in a hurry to go somewhere right now... be back in an hour or two... I'll explain more then if needed...

 

later

Posted
Check you have spelt all table and column names correctly - failure to do so often results in this error when using access.

Heh... quantity is spelled wrong... I'm such an idiot. :P

 

thx

Posted

I have fixed the spelling errors and the exception is still thrown. I'm sure it's just the SQL statement is not set up right. I'll explain what I'm doing now that I have time.

 

I am making a shipping program for my parents machine shop. When a new product order (P.O.) comes in, the secretary enters in all of the line items on that P.O. into the program. When we ship parts, she finds the order on the 'Pending Sales' grid control and adds a shipment to it. It can be a partial shipment, which is why I have the WHEN part of it like it is, to make sure it still shows up until the QuantityComplete is >= Quantity (on order)

 

I have a ProductsOrder table, a Parts table, a LineItems table, and a Customer table (I have more, but those are the only relevant ones)

 

The LineItems table has a relationship to 'Customers', 'Parts', and 'ProductOrders' tables.

 

The following is how the grid is setup, and what info needs to be pulled for the the columns:

 

| Part Number | Customer | Description | Quantity | Due Date |

 

and the fields are

 

| Parts.PartID | Customers.CustomerID | Parts.Description | LineItems.Quantity | LineItems.DueDate |

 

Thanks in advance for any help. I hope this was clear, I just typed it out real quick.

  • *Experts*
Posted

I'd suggesting printing out your string, txtSelectCommand in your first sample code, and running that from inside Access. I see a problem in your query in that you're selecting from 3 tables but the WHERE is only filtering LineItems (QuantityComplete < Quanity). Where's the join criteria for Parts and Customers?

 

If you run the query in Access, I think you'll find PD's advice is true - it's most likely a mis-spelled column or table that Access is assuming is a parameter. If you run this in Access, it may provide more help on which column/table is spelled wrong.

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted
I'd suggesting printing out your string, txtSelectCommand in your first sample code, and running that from inside Access. I see a problem in your query in that you're selecting from 3 tables but the WHERE is only filtering LineItems (QuantityComplete < Quanity). Where's the join criteria for Parts and Customers?

 

If you run the query in Access, I think you'll find PD's advice is true - it's most likely a mis-spelled column or table that Access is assuming is a parameter. If you run this in Access, it may provide more help on which column/table is spelled wrong.

 

-ner

ok, I will try this as soon as I get to that computer.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...