Last post Apr 27, 2018 02:41 AM by oned_gk
Apr 26, 2018 03:28 AM|ProgBeginner|LINK
Hi, how do i fill my textbox based on the selection in drop downlist using sql procedure.
i select Name in the dropdownlist
i wish to have contact number and department display in my textbox.
Apr 27, 2018 02:28 AM|Fei Han - MSFT|LINK
The OnSelectedIndexChanged event of DropDownList control will fire when the selected index has been changed, in this event you can call your Stored Procedures using ADO.Net to retrieve contact number and department information from your database
and assign the value to textbox.
You can refer to this article: “Calling Select SQL Server Stored Procedures using ADO.Net” to call your Stored Procedures.
Apr 27, 2018 02:41 AM|oned_gk|LINK
It's similar when using sql command with commandtype.text
You need a parameter in stored procedure, then modify your code
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "mysp";
CREATE PROCEDURE mysp(@Param1 varchar)
select * from Users where userName=@Param1