Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
what is the wrong ??
C#
try
 {
    SqlConnection con = new SqlConnection(@ "jjj");
    SqlCommand comm = new SqlCommand("select [??????_??????] from client where [???   _??????]= '" + comboBox1.SelectedValue + "' ", con);
   con.Open();
   prevtxt.Text =(string)comm.ExecuteScalar();
   con.Close();
 }
 catch (System.Exception ex)
 {
   MessageBox.Show(ex.Message);
  }
Posted
Updated 31-Jan-13 12:18pm
v3
Comments
DinoRondelly 31-Jan-13 18:18pm    
Is this a test? You tell me whats wrong ...
Winston Madiano 1-Feb-13 0:49am    
My idea, use sqlparameters for security against SQL injection. (Ex. command.parameters.addWithvalue("@","") )

If the datatype of your (Where [??? _??????]") is string then convert combobox Selected value to string.

Dispose your objects properly.. by using "using", or "dispose" keyword.
Sergey Alexandrovich Kryukov 31-Jan-13 18:21pm    
The questions like "what's wrong" cannot be valid if you don't tell us what do you try to achieve. What is wring for one purpose can be right for another...
Of course, if you stuff a query with ???????, you cannot expect anything good...
—SA
Member 9702410 31-Jan-13 18:33pm    
NO , i already want to fill textbox using combobox value as where condition an i try this code but there is no text in textbox
DinoRondelly 31-Jan-13 18:36pm    
Does the query return anything?

1 solution

your textbox need be active multiline and in the moment of asigment use the += and don't use only =
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900