Wednesday, March 28, 2012

If Exists problem

I want to enter a website address into a TextBox and on AutoPostBack check to see if the entry is LIKE any in a SQL 2000 database tblLinkAddresses. If it is not - add it to the table and if it is display the LIKE matches.

Where do I start?

I am stupid - got the if it matches problem solved - just need to know how to add a textbox entry to a database table on a button click.

|||

SqlConnection _sqlconnection=new SqlConnection('place your connectionstring')

_sqlconnection.Open();

SqlCommand _cmd=new SqlCommand('your stored procedurename ',_sqlconnection);

_cmd.CommandType=CommandType.Storedprocedure;

_cmd.Parameter.Add(new SqlParameter('@.parametername',SqlDBType.Varchar,50));

_cmd.Parameter["@.parametername"].value=Text1.Text;

_cmd.ExecuteNonQuery()

No comments:

Post a Comment