Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Aug 04, 2010 03:20 PM by Dmusselman
Jul 29, 2010 07:57 PM|LINK
I need some help here. I'll try to explain what I need as best as I can. Let says that I have 1 page website in C#. I have a table called Employee With one colum called emplyee name. On the webpage I have a text box, button, and a label. The end user
enters in a name in the text box. Than clicks on a button. I what to manually search the table to see if the name is already in use. if so it will display a message using the lable. If its not in use than it will add the information to the database. Than
it will display a message using the label letting the end user know that the data was saved. Now I do have a contactionstring in the web.config file. Please keep it sample. please help.
Jul 30, 2010 08:33 AM|LINK
you can write following sql query in your stored procedure,
if exists (select 1 from Employee where EmployeeName = @empName)
select 0 as empExists
insert into Employee values (employeeName, all your other columns)
select 1 as RecordInserted
Jul 30, 2010 03:25 PM|LINK
Okay Thank., Now what about the code behind aspx page for the button to connect to SQL to run the stored procedure. Let say that I have a connectionString in my Web.config file named MYSQLDB. Give me an exsample of a Default.aspx, Default.aspx.cs (please
include namespaces that are being used) that has 1 textbox1, Lable1, Button1. Plus a full script layout of the stored procedure. The only reason why I'm asking is so that I can study it and use it thru out my website.
Aug 04, 2010 08:40 AM|LINK
Please refer this article,
Aug 04, 2010 03:20 PM|LINK
Thank you very much thats what I been looking for. Thank you everyone for y'alls help.