I want to share my class for database processes. I mean SQL CRUD processes. Create(Insert), Read(Select), Insert and Update.
If you are using stored procedures in your web projects it's very usefull for you. Because you just write your sql parameters and stored procedure name and then finish. Just it.
Here is the class and code sample.
web.config example:
< connectionstrings>
< add pooling="True;"" info="False;" security="" persist="" pwd="password;" uid="sa;" database="dbname;" source="KADIR-PC\SQLEXPRESS;" connectionstring=""Data" name=""localhost"">< /add>
< / connectionstrings>
Class usage:
SqlParameter[] param = new SqlParameter[6];
param[0] = new SqlParameter("@catname", "test");
param[1] = new SqlParameter("@title", "testsd");
param[2] = new SqlParameter("@description", "tt");
param[3] = new SqlParameter("@keywords", "tst");
param[4] = new SqlParameter("@active", 1);
param[5] = new SqlParameter("@date", DateTime.Now);
DataTable dtInsert = dbHelper.runQueryWithParams("insert_categories", param);