How can I add a data from a textbox into a ms sql database?
Because everywhere I read, it tells me how to display data, but not how to insert data...
How are you connection to your database...ADO, ODBC...whatever the case...if you write queries to select and diplay data...then you can also write queries to insert data...just make sure your database table allows insert...
if you are using some control and not codebehind, then they have Insert option...
Please be more specific of what you want to use and you will get more help...
thanks,
bullpit
|||Im using ado...
For example lets say I create a table in mssql that allows insertion.
How can send the data from my textbox to the table.
I dont want to use a control...
From a textbox into the database...
Thank you
|||This may help you get started, hope it helps -- jpstring valueToInsert = yourTextBox.Text;string insertStr ="insert into yourTable (fieldTo) values (" + valueToInsert +")";SqlConnection conn =new SqlConnection(yourConnectionString);SqlCommand cmd =new SqlCommand(conn, insertStr);using(conn){using(cmd) { conn.Open(); cmd.ExecuteNonQuery(); }}
No comments:
Post a Comment