不同的数据库采用不同的字符串,常用几种如下:

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");

相关文章:

  • 2022-03-06
  • 2021-05-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-07
  • 2022-02-11
  • 2022-12-23
  • 2021-06-19
相关资源
相似解决方案