Click here to Skip to main content
15,891,687 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
private void btnVwClient_Click(object sender, EventArgs e)
       {
           SqlDataAdapter da = new SqlDataAdapter("select * from client where clientId='" + txtNoCli.Text + "'", con);
           DataSet ds = new DataSet();
           da.Fill(ds, "client");
           DataView dv = new DataView(ds.Tables["client"]);
           dataGridView2.Visible = true;
           dataGridView2.DataSource = dv;
       }
Posted
Comments
Santhosh Kumar Jayaraman 10-Aug-12 3:22am    
Your question title and the description didnt match. can you please give us some more explantion?
[no name] 10-Aug-12 7:39am    
This is just a code dump. No question. No description of a problem.

1 solution

Your question is very unclear, but I will tell you this. Your code is not production quality. If I wanted to, I could erase your entire DB by doing a SQL Injection attack on this form. You need to read up on the right way to build SQl, using paramaterised queries. This looks like someone could be paying for it, and no-one should ever use this code in real life on a secure system.
 
Share this answer
 
Comments
AspDotNetDev 13-Aug-12 19:38pm    
I voted your answer a 2 because it is not an answer (however useful the advice may be). If you think the question is garbage, downvote, delete, edit, or comment on it. If you think there is something tangentially related to the code that is not an answer, post it as a comment.
Christian Graus 16-Aug-12 13:32pm    
Fair enough. You'll notice I made my reply when this was days old. I am more careful about what I respond with, in the form of an answer, when a question looks active, and not abandoned.

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