/*sqlconection 객체 생성 */
SqlConnection oCnn = new SqlConnection();
bool bcheckIsConnection = false;
try
{
oCnn.ConnectionString = "server=147.46.197.27;database=MANUFACTUREDB;user=sa;pwd=uscm";
oCnn.Open();
bcheckIsConnection = true;
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
if (bcheckIsConnection)
{
//쿼리를 스토워드프로시져 사용 SqlCommand oCmm = new SqlCommand("프로시져이름", 커넥션 객체)
SqlCommand oCmm = new SqlCommand("USP_데이터초기화",oCnn);
oCmm.CommandType = CommandType.StoredProcedure;
//쿼리실행
oCmm.ExecuteNonQuery();
oCnn.Close();
'Computerscience > C#' 카테고리의 다른 글
c# 훅크 사용법[스크랩] (0) | 2009.08.13 |
---|---|
DatagrideView에 쿼리 반환값 넣기[기초] (0) | 2009.02.13 |
DB 연동하기 (0) | 2009.02.13 |
메세지박스 활용법 (0) | 2008.09.04 |
C#과 C++ 문법적으로 다른점 (0) | 2007.11.23 |