end ifrst.closeset rst=nothing%></p>
public static void Update(Connection con, String sql, Object... objects) {PreparedStatement pre = null
try {
pre = con.prepareStatement(sql)
for (int i = 0i <objects.lengthi++) {
pre.setObject(i + 1, objects[i])
}
pre.executeUpdate()
} catch (SQLException e) {
e.printStackTrace()
}
}
string ConnectionString = "Data Source=数据源Database=数据库名称uid=用户Pwd=密码"string sql = "update 数据表 set 字段1= '开',字段2='" + dt + "' (where +限定条件)
SqlConnection conn = new SqlConnection(ConnectionString)
conn.Open()
SqlCommand cmd = conn.CreateCommand()
cmd.CommandText = sql
cmd.ExecuteNonQuery()
conn.Close()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)