Click here to Skip to main content
       

C#

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
QuestionError: No value given for one or more required parameters ?membertaibc16 Feb '13 - 1:18 
Hi,
 
I am using below codes to bind data to a list box. But I got this error.
 
DataTable tbl= new DataTable();
OleDbDataAdapter da = new OleDbDataAdapter("select * from myTable", mycon);
if (da == null)
  return;
da.Fill(tbl);
myListBox.DataSource = tbl.DefaultView ; // Throw error
myListBox.DisplayMember = "CustomerName"; // Throw error
myListBox.ValueMember = "CustomerCode"; // Throw error
 
Are there anyone can help ?
 
Thanks and regards,
AnswerRe: Error: No value given for one or more required parameters ?mvpEddy Vluggen16 Feb '13 - 1:37 
You forgot to include the error-message in your post. I assume you did set a connectionstring and the likes?
Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]

GeneralRe: Error: No value given for one or more required parameters ?membertaibc16 Feb '13 - 1:55 
The error-message is same as the topic: No value given for one or more required parameters
 
Kind regards,
GeneralRe: Error: No value given for one or more required parameters ?mvpEddy Vluggen16 Feb '13 - 2:05 
Ah. Can you post it, including the stack-trace?
 
Try setting the datasource after setting the displaysource and valuemember.
 
Can you also show us the code where the connection is created?
Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]

GeneralRe: Error: No value given for one or more required parameters ?membertaibc16 Feb '13 - 3:59 
Thanks Eddy,
 
I tried to set the datasouce after setting the displaysource and valuememember. Then, I only got the error at the line setting datasource.
 
This is the connection string: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=./data/system.mdb.
 
And after the line: da.Fill(tbl);
 
the DataTable variable tbl still has data
AnswerRe: Error: No value given for one or more required parameters ?mvpAbhinav S16 Feb '13 - 6:27 
CustomerName and CustomerCode are columns should be valid columns in the myTable table.

GeneralRe: Error: No value given for one or more required parameters ?membertaibc16 Feb '13 - 14:47 
Hi all,
 
I resolved this problem.
 
After the statement:
myListBox.DataSource = tbl.DefaultView ;
 
It call to the event "Selected Index Change" of the listbox. In this event, I used a statement:
 
string code = myListBox.SelectedValue.ToString();
But myListBox.SelectedValue.ToString() return type DataRowView (not code value, because the datatable includes two columns), and it created the error.
 
So, I moved the setting DataSource after setting DisplayMember and ValueMember then it is ok
GeneralRe: Error: No value given for one or more required parameters ?mvpAbhinav S16 Feb '13 - 22:50 
Cool. Thanks for posting the solution here.

QuestionC# not release processes [modified]memberclassy_dog15 Feb '13 - 9:28 
In a C# 2008 desktop application, I am finding that there are processes that are not released once when the application finishes executing.
Every time this application runs, there are more processes that are not released. I want to mention this application was originally written as a console application, but was changed to a windows application since I did not want all the dos popup windows.
 
I do want to mention that in this application the following is not occuring:
 
1. When some of the objects are created, there is no dispose on the objects.
 
2. Some of the linq statements do not have a using clause on them.
 
What kind of code could be causing this problem?

Thus can you tell me, point me to a reference, and/or show me code on how to reolve this problem?

modified 15 Feb '13 - 15:42.

AnswerRe: C# not release processesmvpEddy Vluggen15 Feb '13 - 9:47 
classy_dog wrote:
What kind of code could be causing this problem?

A "foreground" thread that should have been a background thread; the app would be running on the background until the thread dies, whereas a backgroundthread is terminated when the app closes.
 
That's assuming that you're launching these processes; otherwise they wouldn't be related to your code.
 
(Just to check, with a process, you did mean a "running executable"?)
Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 23 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid