Hi..
now i'm working with asp.net c#.. i want to view the data from database in the textbox in order to make editing to the data is avaiable..but i'm using user stored procedure..
now this is my code where i want to display the data..
<tr>
<td class="style1">Company Code </td>
<td>:</td>
<td>
<asp:TextBox ID="txtCmpCode" runat="server" Width="80" BorderStyle="Groove" MaxLength="10" ReadOnly="true"></asp:TextBox
Company Name: <asp:TextBox ID="txtCmpName" runat="server" Width="217" BorderStyle="Groove">
</td>
</tr>
for the back end code is
protected void Page_Load(object sender, EventArgs e)
{
string strCompCode = Request.QueryString["comp_code"].ToString();
SearchData(strCompCode);
}
//SearchData
public void SearchData(string CmpCode)
{
//Define Class gdex
gdexClass gd = new gdexClass();
//Open Database Connection
SqlConnection sqlconnection = gd.GetConnection();
//Define Store Procedure
SqlCommand Cmd = new SqlCommand("usp_TbCompany_sc", sqlconnection);
Cmd.CommandType = CommandType.StoredProcedure;
//Bind Data from tbe control to Stored Procudure
Cmd.Parameters.AddWithValue("@CmpCode", CmpCode);
Cmd.Parameters.Add("@CmpCode", SqlDbType.NVarChar, 10);
Cmd.Parameters.Add("@CmpName", SqlDbType.NVarChar, 100);
String Comp_Code = (string)Cmd.Parameters["@CmpCode"].Value;
String Comp_Name = (string)Cmd.Parameters["@CmpName"].Value;
Cmd.Connection = sqlconnection;
sqlconnection.Open();
txtCmpCode.Text = Comp_Code;
txtCmpName.Text = Comp_Name;
sqlconnection.Close();
for the txtCmpCode is successfully display because of the parameter passing, but for the rest i dont know what should i do else..i had tried many ways but not solve yet..
please anybody can help me..