开发者

TelerikRadGrid how to insert,update and delete into SQL database

I am using 开发者_Go百科Telerik controls in Visual Studio 2008, in RadGrid. I create a PopUp windows includes all the TextBoxes and controls that I need to use in database but how can I declare a function in order to insert, update and delete ? And where!?


You can use Data Access Layer for Definition of the the function to send the request to database

If you want to use SQL Server. Following is the code.

using (System.Data.SqlClient.SqlConnection con = new SqlConnection("YourConnection string")) { 
    con.Open(); 
    SqlCommand cmd = new SqlCommand(); 
    string expression = "Parameter value"; 
    cmd.CommandType = CommandType.StoredProcedure; 
    cmd.CommandText = "Your Stored Procedure"; 
    cmd.Parameters.Add("Your Parameter Name", 
                SqlDbType.VarChar).Value = expression;    
    cmd.Connection = con; 
    using (IDataReader dr = cmd.ExecuteReader()) 
    { 
        if (dr.Read()) 
        { 
        } 
    } 
}

You can also use Microsoft Enterprise Library

You can Use Business Logic Layer to call the database layer function and also can perform validations before sending the data to Presentation Layer

Finally, You can call the Business Logic Layer objects in your Presentation layer

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜