Click here to Skip to main content
15,886,075 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to use class file for every sql command. How to pass parameters for required columns in the class file.

How to create class file for every sql command.

Please help me. Thanks in advance
Posted

1 solution

do you mean : you have 1 class , in this class you open the connection to database , create sqlcommand and execute it , get parameters is the sql query from outside?
then in the form you want, you call back the before class ?
 
Share this answer
 
Comments
rahul dev123 13-May-11 9:23am    
please help me providing the example code
SaoLamEmDau 13-May-11 9:40am    
first, you create new class vd ketnoi.cson the class ketnoi

in the using library, you use System.Data.SqlClient;

you create 1 method taoKetNoipublic void KetNoi()
{

SqlConnection KetNoiMoi=new SqlConnection();

KetNoiMoi.ConnectionString=@"DataSource=./sqlexpress;initial catalog=YourDataBaseName(not include the extension of file);persist security=true;pooling=false";

KetNoiMoi.Open();}
//i don't have enough time, the next time ok

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