Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I have a web page as configuration.aspx and have sample.sql database script in my projet.

in configuration.aspx page i have testbox as servername,databasename,AuthenticationMode,SQLUid,SQLPassword.
and a Button Submit.

Now I have to run sql script dynamically on button click event.
Please let me know how to do it.

Mohammad Wasif
Posted
Comments
Ryan Zahra 9-Mar-11 8:41am    
What have you done so far?

http://www.google.com/#sclient=psy&hl=en&q=run+sql+script+on+button+click+event&aq=f&aqi=&aql=&oq=&psj=1&bav=on.2,or.&fp=cd65a9facc26f8d0[^]

I hope the above information will be helpful. If you have more concerns, please let me know.
 
Share this answer
 
I'm not sure I understood your question, but your form should look like:

<input name="nome" type="text" />
...
...
<input name="submit" type="submit" class="submit" value="submit"  />




and then the code to process the data:


if (submit == "submit")
            {
                string name = "";
               ....
                name = Request.QueryString["nome"];
               ....
             and then the sql processing

string query = "........','" + name + "')";
                        SqlCommand cmd = new SqlCommand(query, Conn);
                        cmd.ExecuteNonQuery();

}


Of course you should adapt to your needs.

There are other ways to retrieve data from forms, but that depends if you are using pure html or .net controls.

For asp.net controls see here:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.click(v=VS.90).aspx[^]
 
Share this answer
 
read .sql file in text string

generate connection strings using the servername,databasename,AuthenticationMode,SQLUid,SQLPassword.

use ADO.NET to execute the script.

does this help or you want code?
 
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