Click here to Skip to main content
14,836,361 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I am a beginner in c# and I want to Retrieve data from Database & Display into ASP.NET Textbox controls using SQL Stored Procedure?. plz help me...

you can use to retrieve data from database.

If you want only single value from database to display in Textbox then you can use ExecuteScalar() ...

I am assuming you are using SQL server database.. Follow this link :[^]

If you want to use Stored Procedure instead of Inline query then set CommantType attribute as given below...

System.Data.SqlClient.SqlCommand objCommand = new System.Data.SqlClient.SqlCommand();
                objCommand.CommandType = System.Data.CommandType.StoredProcedure;

Hope this will help...
You need to use ADO.NET classes if you are to perform the task programatically

C# code

using System.Data.SqlClient;

//in your class or method .........
SqlConnection con=new SqlConnection("write connection string here");

SqlCommand cmd=new SqlCommand("my_procedure",con);
SqlDataReader dr=cmd.ExecuteReader();

these links may be helpful
how to display data from sql database to textbox using[^][^]

Use this code Best of Luck.......

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