开发者

Help in web.config

Well, I am modifying an application in ASP.NET. This application was originally connected to an Oracle8i database, my idea is to connect to a new exactly the same but in SQL Server 2008 R2.

When I change the class that handles the connection and remove the errors that Visual Studio tells me I run http://localhost/ page jumps me an error like this.

Error instance. Description: An unhandled exception when you run 开发者_开发百科the current web request. Check the stack trace for more information about the error and where it originated in the code.

Error de instancia. Descripción: Excepción no controlada al ejecutar la solicitud Web actual. Revise el seguimiento de la pila para obtener más información acerca del error y dónde se originó en el código.

Detalles de la excepción: System.InvalidOperationException: Error de instancia.

Error de código fuente:

Línea 1535:            using (SqlCommand.Connection)
Línea 1536:            {
Línea 1537:                SqlCommand.Connection.Open();
Línea 1538:                Table.Load(SqlCommand.ExecuteReader());
Línea 1539:            }

And I have another question. In the web.config file is a line like this.

<add key="DatabaseProvider" value="Test.App.Oracle8i"/>

I thought. Oracle8i was referring to the class that I edited and then as I changed the name to SqlServer then left it as follows

<add key="DatabaseProvider" value="Test.App.SqlServer"/>

And if you do not mind but my connection string I'm using in the web.config is like this.

<add name="cString" connectionString="Data Source=(local)\\MSSQLSERVER;Initial Catalog=TESTDATABASE;User Id=testuser;Password=testpassword;"/>

It might not have looked good, but I need to guide me I've read many times the code and although I understand that is supposed to do almost everything I can not get that error.


Start by removing the extra '\' in the connection string.

It should be:

<connectionStrings>
   <add name="cString" 
       connectionString="Data Source=.\MSSQLSERVER;Initial Catalog=TESTDATABASE;User Id=testuser;Password=testpassword;"/> 
</connectionStrings> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜