.net中连接数据库的字符串(c#)
不同的数据库采用不同的字符串,常用几种如下:
1,sqlserver
sqlconnetion coon=new sqlconnection("Data Sourse=localhost;Inregrated Secyrity=SSPI;Initial Catalog=student(数据库名称);User ID=sa;psw=12345;(没有密码就不写这个)“);
2,oledb数据源
oledbConnection coon=new oledbconnection("Provider=sqloledb;data source =localhodt;Integrated security=SSPI;Initial catalog=student");
3,odbc
odbcconnection coon=new odbcconnection("driver={sql server}; server=(local);Trusted_Connection=Yes;Database=student");
4,连接oracle数据库
oracleconnection coon=new oracleconnection("data source=localhost;Integrated secrity=yes");