Click here to Skip to main content
15,898,538 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: CSS menu change in Asp.net Pin
Christian Graus26-Jul-09 20:07
protectorChristian Graus26-Jul-09 20:07 
GeneralRe: CSS menu change in Asp.net Pin
mark_me27-Jul-09 6:06
mark_me27-Jul-09 6:06 
Questionbest way to update an xml file once per day on web application? Pin
dd31415926-Jul-09 7:02
dd31415926-Jul-09 7:02 
AnswerRe: best way to update an xml file once per day on web application? Pin
Abhishek Sur26-Jul-09 9:44
professionalAbhishek Sur26-Jul-09 9:44 
GeneralRe: best way to update an xml file once per day on web application? Pin
dd31415926-Jul-09 11:21
dd31415926-Jul-09 11:21 
AnswerRe: best way to update an xml file once per day on web application? Pin
Mike Ellison26-Jul-09 13:38
Mike Ellison26-Jul-09 13:38 
Questionasp.net display data in gridview [modified] Pin
solo_gaurav26-Jul-09 5:18
solo_gaurav26-Jul-09 5:18 
AnswerRe: asp.net display data in gridview Pin
Abhijit Jana26-Jul-09 6:58
professionalAbhijit Jana26-Jul-09 6:58 
Just Try this one

protected void  DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {  
       DataSet Ds=new DataSet();
        con = new SqlConnection("Data Source=.;Initial Catalog=abc;Integrated Security=True");
        cmd = new SqlCommand("select * from salescounts where ='"+DropDownList1.Text+"'", con);
        SqlDataAdapter DA = new SqlDataAdapter(cmd);
                DA.Fill(ds);  
          if(Ds.Tables[0].Rows.Count>0)
           {
                GridView1.DataSource = ds;
                GridView1.DataBind();
                Label1.Text = "Result found:" + GridView1.Rows.Count;

            }
            else
            {
                Label1.Text = "not found";
            }

            con.Close();
        
}


Quick Suggestion :

solo_gaurav wrote:
cmd = new SqlCommand("select * from salescounts where ='"+DropDownList1.Text+"'", con);


Never Execute SQL Query like this from UI level. It will causes SQL Injection. Always used Parameterized query / Stored Procedure .

Thansk Big Grin | :-D

Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
View My Latest Article

GeneralRe: asp.net display data in gridview Pin
solo_gaurav26-Jul-09 7:36
solo_gaurav26-Jul-09 7:36 
GeneralRe: asp.net display data in gridview Pin
Abhijit Jana26-Jul-09 8:40
professionalAbhijit Jana26-Jul-09 8:40 
GeneralRe: asp.net display data in gridview Pin
solo_gaurav26-Jul-09 10:28
solo_gaurav26-Jul-09 10:28 
GeneralRe: asp.net display data in gridview Pin
Abhijit Jana26-Jul-09 11:11
professionalAbhijit Jana26-Jul-09 11:11 
AnswerRe: asp.net display data in gridview Pin
Paul Conrad26-Jul-09 10:57
professionalPaul Conrad26-Jul-09 10:57 
Questionin my system mechine.config is not there in the bellow path.why ? how to create Pin
Ramesh Reddy1111126-Jul-09 3:37
Ramesh Reddy1111126-Jul-09 3:37 
AnswerRe: in my system mechine.config is not there in the bellow path.why ? how to create Pin
Manas Bhardwaj26-Jul-09 3:59
professionalManas Bhardwaj26-Jul-09 3:59 
QuestionRetaining the string entered in File Upload Control Pin
meeram39526-Jul-09 3:22
meeram39526-Jul-09 3:22 
AnswerRe: Retaining the string entered in File Upload Control Pin
Abhishek Sur26-Jul-09 10:39
professionalAbhishek Sur26-Jul-09 10:39 
GeneralRe: Retaining the string entered in File Upload Control Pin
meeram39526-Jul-09 21:23
meeram39526-Jul-09 21:23 
GeneralRe: Retaining the string entered in File Upload Control Pin
Abhishek Sur26-Jul-09 21:54
professionalAbhishek Sur26-Jul-09 21:54 
QuestionSession Variables Mysteriously Go Null Pin
PDTUM25-Jul-09 16:27
PDTUM25-Jul-09 16:27 
AnswerRe: Session Variables Mysteriously Go Null Pin
Abhijit Jana25-Jul-09 20:45
professionalAbhijit Jana25-Jul-09 20:45 
GeneralRe: Session Variables Mysteriously Go Null Pin
PDTUM26-Jul-09 4:20
PDTUM26-Jul-09 4:20 
AnswerRe: Session Variables Mysteriously Go Null Pin
Abhishek Sur25-Jul-09 21:31
professionalAbhishek Sur25-Jul-09 21:31 
AnswerRe: Session Variables Mysteriously Go Null Pin
Manas Bhardwaj25-Jul-09 22:58
professionalManas Bhardwaj25-Jul-09 22:58 
QuestionOpen PDF from Gridview Link Pin
PDTUM25-Jul-09 10:16
PDTUM25-Jul-09 10:16 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.