数据库
首页 > 数据库> > winform操作数据库

winform操作数据库

作者:互联网

1.获取连接

 SqlConnection con = SqlConnect.getConn();

2.绑定SqlConnection对象

SqlCommand command = con.CreateCommand();

3.绑定SQL语句

 String deleteStr = "delete from WorkingLine where StationName=@STATIONNAME";
 command.CommandText = deleteStr;

4.绑定参数

con.Open();
command.Parameters.AddWithValue("@STATIONNAME", name);

5.执行SQL语句

 command.ExecuteNonQuery();

标签:数据库,绑定,deleteStr,command,STATIONNAME,SqlConnection,操作,winform,con
来源: https://blog.csdn.net/qq_44771537/article/details/118944287