C# 代码:.cs文件里面的
public static DbCommand CreateCommand()
{
// Obtain the database provider name
string dataProviderName = WebSiteConfiguration.DbProviderName;
// Obtain the database connection string
string connectionString = WebSiteConfiguration.DbConnectionString;
// Create a new data provider factory
DbProviderFactory factory = DbProviderFactories.GetFactory(dataProviderName);
// Obtain a database specific connection object
DbConnection conn = factory.CreateConnection();
// Set the connection string
conn.ConnectionString = connectionString;
// Create a database specific command object
DbCommand comm = conn.CreateCommand();
// Set the command type to stored procedure
comm.CommandType = CommandType.StoredProcedure;
// Return the initialized command object
return comm;
}WebSiteConfiguration”的类型初始值设定项引发异常。
public static DbCommand CreateCommand()
{
// Obtain the database provider name
string dataProviderName = WebSiteConfiguration.DbProviderName;
// Obtain the database connection string
string connectionString = WebSiteConfiguration.DbConnectionString;
// Create a new data provider factory
DbProviderFactory factory = DbProviderFactories.GetFactory(dataProviderName);
// Obtain a database specific connection object
DbConnection conn = factory.CreateConnection();
// Set the connection string
conn.ConnectionString = connectionString;
// Create a database specific command object
DbCommand comm = conn.CreateCommand();
// Set the command type to stored procedure
comm.CommandType = CommandType.StoredProcedure;
// Return the initialized command object
return comm;
}WebSiteConfiguration”的类型初始值设定项引发异常。
解决方案 »
- 新手求救,GridView怎么做数据排序?
- 把dataGridView 中的数据 导出到excel
- C#程序发布问题。
- 关于几乎同时用filestream打开同一个文本后面一个程序报错的问题
- 一个很困绕小弟的问题,高人进来看看哈
- 请提供一个关于c#实现的socket的网络通讯的例子
- 高分求解!web程序在调试时提示:无法开始调试,无法找到Microsoft Internet Explorer。请问是什么原因?
- C#做b/s结构的数据库程序和网络编程是否合理?
- 难题!!!!!!!!!!!!
- 那这段代码在c#中不对是吗?
- C#异步和同步哪个快?
- Microsoft JScript 运行时错误: Sys.ParameterCountException: 参数计数不匹配。
中为DbProviderName属性赋值的时候可能从配置文件读设置,但是配置配置文件中可能没有设置,检查一下配置文件