how to create expander dynamically?

Create a table dynamically in sql from values in textboxes in webform?

  • hey guys, i m trying to create a table dynamically in sql from the values entered by user in two textboxes in asp.net using c#, i have tried with the below snippet of code but its giving error, Please help friends asap, waiting for reply protected void Button1_Click(object sender, EventArgs e) { conn.Open(); cmd = new SqlCommand("Insert into standard VALUES(@st,@di)", conn); cmd.Parameters.AddWithValue("@st", std.Text); cmd.Parameters.AddWithValue("@di", div.Text); cmd.ExecuteNonQuery(); cmd = new SqlCommand("Create table class'" + std.Text + div.Text + "'(rollno int primary key, std nchar(10), div nchar(10),name text,pwd text)'", conn); //cmd = new SqlCommand("Create table std'" +@st+"'div'"+@di+ "'(rollno int primary key,std nchar(10), div nchar(10),name text,pwd text)'", conn); cmd.ExecuteNonQuery(); }

  • Answer:

    Risky..very risky. You're just asking for an sql injection attack...

neelam at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.