運算元據類m

2022-07-28 01:33:12 字數 1228 閱讀 5028

using system;

using system.collections.generic;

using system.linq;

using system.text;

using system.threading.tasks;

using system.data.sqlclient;

//造連線物件

sqlconnection conn = new sqlconnection("server=.;database=mydb;user=sa;pwd=123");

//造命令物件

sqlcommand cmd = conn.createcommand();

//給命令物件一條sql語句

cmd.commandtext = "select * from car where code=@code";

cmd.parameters.addwithvalue(@code,code);

//改變量繫結引數

cmd.parameters.clear();//清除繫結的變數

cmd.parameters.addwithvalue("@code", code);

"@name",name);

//開啟連線

conn.open();

//執行sql語句

sqldatareader dr = cmd.executereader();

//讀取資料

if (dr.hasrows)

}else

console.writeline("1是刪除2是修改3是新增");

int a = int.parse(console.readline());

dr.close();

if (a == 1)

else if (a == 2)

else if (b == "exhaust")

else if (b == "price")

else

m++;

console.writeline("是否繼續修改內容?是1不是2");

int n = int.parse(console.readline());

if (n == 1)

else}}

else if (a == 3)

else

//關閉連線

conn.close();

console.readline();

}

運算元據庫幫助類

1 sqlserver public class sqlhelper else if connection.state system.data.connectionstate.closed else if connection.state system.data.connectionstate.br...

運算元據庫的類 C

using system using system.data using system.data.sqlclient using microsoft.win32 using system.reflection using system.io using system.web using system...

運算元據庫的類 C

using system using system.data using system.data.sqlclient using microsoft.win32 using system.reflection using system.io using system.web using system...