간단한 소스라 굳이 설명은 필요 없을 것 같습니다.
지정된 DB에 접속해서 간단한 DML(Data Manipulation Language) 수행 소스 입니다.
즉, 데이터를 가져오는 소스 샘플이 아니라, Insert, Update, Delete 등의 데이터 조작을
하는 소스라 보시면 됩니다.
int iResult = 0; // DB 접속 string strConn = string.Format("server={0};database={1};Connect Timeout=15;user id={2}; password={3}", db_ser_ip, db_ser_name, db_ser_id, db_ser_pw); DataSet ds = new DataSet(); SqlConnection con = new SqlConnection(strConn); con.Open(); // DB 접속 후, 쿼리문 실행 SqlCommand command = new SqlCommand(strQuery, con); command.CommandTimeout = 10; iResult = command.ExecuteNonQuery(); //DB 연결 종료 con.Close();
댓글