下列ASP.NET语句()正确地创建了一个与SQL Server 2008数据库的连接。
A: str="server=.,uid="zhangsan",pwd="123",database=mydb";SqlConnection con=new SqlConnection;
B: str="server=.;uid="zhangsan";pwd="123";database=mydb";SqlConnection con=new SqlConnection;
C: str="server=.;uid=zhangsan;pwd=123;database=mydb";SqlConnection con=new SqlConnection;
D: str="server=.,uid=zhangsan,pwd=123,database=mydb";SqlConnection con=new SqlConnection;
A: str="server=.,uid="zhangsan",pwd="123",database=mydb";SqlConnection con=new SqlConnection;
B: str="server=.;uid="zhangsan";pwd="123";database=mydb";SqlConnection con=new SqlConnection;
C: str="server=.;uid=zhangsan;pwd=123;database=mydb";SqlConnection con=new SqlConnection;
D: str="server=.,uid=zhangsan,pwd=123,database=mydb";SqlConnection con=new SqlConnection;
举一反三
- 下列ASP.NET语句 ( )正确地创建了一个与SQL Server数据库的连接。 A: SqlConnection conn = new Connection("Data Source = localhost; Integrated Security = SSPI; Initial Catalog = myDB") B: SqlConnection conn = new SqlConnection("Data Source = localhost; Integrated Security = SSPI; Initial Catalog = myDB") C: SqlConnection conn = new SqlConnection(Data Source = localhost; Integrated Security = SSPI; Initial Catalog = myDB) D: SqlConnection conn = new OleDbConnection("Data Source = localhost; Integrated Security = SSPI; Initial Catalog = myDB")
- 下列连接字符实现与SQL Server数据库的连接,()是不正确的。 A: Driver={SQL Server}; Server=localhost; Database=stuDB; Uid=; Pwd=; B: Provider=SQLOLEDB; Data Source=localhost; Database=stuDB; Uid=abc; Pwd=12; C: Data Source=.\\SQLEXPRESS; Database=SchoolDB;Uid=abc; Pwd=; D: Driver={SQL Server 2000}; Server=localhost; Database =stuDB; Uid=abc; Pwd=123;
- 在.NET框架下开发三层结构的数据库应用系统时,using语句范围内定义了一个数据库连接对象,当程序执行到using语句末尾时,将自动释放此数据库对象。假设strSQL为连接字符串,以下using语句使用正确的是( )。 A: using {(SqlConnection conn=new SqlConnection(strSQL)} B: using (SqlConnection conn=new SqlConnection()){strSQL } C: using {}(SqlConnection conn=new SqlConnection(strSQL)) D: using (SqlConnection conn=new SqlConnection(strSQL)){}
- 设cn是一个SqlConnection对象实例,要与SQL Server数据库建立连接,必须使用以下语句
- SQL Server .NET数据提供器,包括了访问Sql Server数据库的各种对象,它不包括( )对象。 A: SqlConnection B: SqlCommand C: DataSet D: SqlDataAdapter