I am trying to work the WroxUnited lessons in CH13, only I am using the MSDE version on WroxUnited (Because SQL is what I use as a database). It has worked fine upto press using this syntax to make a connection from within the aspx pages
Dim connectionString As String = "server='(local)\WroxUnited'; trusted_connection=true; database='WroxUnited'"
Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionStri ng)
However, when this (as part of the data connection functions) are moved to the DataAccessCode.
vb class and then compiled to the DataAccesssCode.dll, the following error occurs when starting the webpage default.aspx
Can anyone help me get this right.
Andrew
~~~~~~~~~~~~~~~~~~~~~~
Invalid PInvoke metadata format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.TypeLoadException: Invalid PInvoke metadata format.
Source Error:
Line 44: 'active dates will still be highlighted.
Line 45: dim DateReader as System.Data.iDataReader
Line 46: DateReader = SQLData.Dates()
Line 47:
Line 48: While DateReader.Read()
Source File: C:\BegASPNet11\WroxUnited\Default.aspx.
vb Line: 46
Stack Trace:
[TypeLoadException: Invalid PInvoke metadata format.]
System.Data.SqlClient.ConnectionPool.GetConnection (Boolean& isInTransaction) +484
System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnectionString options, Boolean& isInTransaction) +311
System.Data.SqlClient.SqlConnection.Open() +383
WroxUnited.DataAccessCode.Dates() +108
Wrox.DefaultCodeBehind.Page_Load() in C:\BegASPNet11\WroxUnited\Default.aspx.
vb:46
System.Web.Util.ArglessEventHandlerDelegateProxy.C allback(Object sender, EventArgs e) +10
System.Web.UI.Control.OnLoad(EventArgs e) +55
System.Web.UI.Control.LoadRecursive() +21
System.Web.UI.Page.ProcessRequestMain() +724
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.288; ASP.NET Version:1.0.3705.288