hi,
I have a one que...
I have a login page and where i m making dropdown for the qualification(B.E.,mca,bca,B.Tech,M.tech,others)Collections in list..

Here for others value..
I have textbox1 so any pne can enter other value that is not in the dropdown...so in that case how i can pass insert query..if any one wants to enter C.A. in textbox...
Plz help
.....How i apply the query with condtion...

Recommended Answers

Hello Pooja, Please show some effort or work.

Give me your pseudo code.

Please read the rules about homework.

Jump to Post

All 3 Replies

Hello Pooja, Please show some effort or work.

Give me your pseudo code.

Please read the rules about homework.

Yes I am agree with finito. regarding your question, it's not that's much difficult. you can create your Insert statement dynamically by checking condition. For example you have two fields name and qualification(nullable) in your table. So your code may looks like

string strSQL = "";
strSQL = "Insert Into yourtable Values('" + txtName.Text + "',";
If (dropdown1.SelectedItem.Value.Equals("value of your Other option in dropdown"))
{
strSQL += "'" + txtOther.Text + "')";
}
else
{
strSQL += "'" + dropdown1.SelectedItem.Value.ToString() + "')";
}
then pass this strSQL to your command object and execute the query.

Hope it will help you :-)

hi,
I have a one que...
I have a login page and where i m making dropdown for the qualification(B.E.,mca,bca,B.Tech,M.tech,others)Collections in list..

Here for others value..
I have textbox1 so any pne can enter other value that is not in the dropdown...so in that case how i can pass insert query..if any one wants to enter C.A. in textbox...
Plz help
.....How i apply the query with condtion...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.