C# 連線資料庫-存入資料
strConn = @"Data Source=IP;Initial Catalog=III_PEO;Persist Security Info=True;User ID=sa;Password=sa";
using(SqlConnection SqlSvrCon = new SqlConnection(strConn))
{
SqlSvrCon.Open();
using (SqlCommand cmd = new SqlCommand("insert into Excel_Local_Result (city, caseId,
bulidingId values (@city, @caseId, @bulidingId)", SqlSvrCon))
{
string city = "台北"
caseId = "055",
bulidingId = "066";
cmd.Parameters.AddWithValue("@city", city);
cmd.Parameters.AddWithValue("@caseId", caseId);
cmd.Parameters.AddWithValue("@bulidingId", bulidingId);
cmd.ExecuteNonQuery();
}
}
標籤: c#
0 個意見:
張貼留言
訂閱 張貼留言 [Atom]
<< 首頁