1,sqlserver
sqlconnetion coon=new sqlconnection("data sourse=localhost;inregrated secyrity=sspi;initial catalog=student(数据库教程名称);user id=sa;ps教程w=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");
时间: 2024-10-14 11:24:56