Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 25th, 2004, 10:58 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error: Invalid PInvoke metadata format

I am receiving Invalid PInvokde metadata format error while inserting a record into MS Access Database. Below is the complete code of my code behind file.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        If Page.IsPostBack Then
            Try
                Dim Mailer As New MailMessage
                Mailer.From = "myemail@test.com"
                Mailer.To = "toemail@test.com"
                Mailer.Subject = "Testing Email in ASP.NET"
                Mailer.BodyFormat = MailFormat.Text
                Dim BodyText As String
                BodyText = "The following information has been submitted:" & vbCrLf
                BodyText = BodyText & "First Name:" & txtFirstName.Text & vbCrLf
                BodyText = BodyText & "Last Name:" & txtLastName.Text & vbCrLf
                BodyText = BodyText & "Email Address:" & txtEmail.Text & vbCrLf
                Mailer.Body = BodyText
                SmtpMail.SmtpServer = "mail-fwd"
                SmtpMail.Send(Mailer)

            Catch ex As Exception

            End Try

            'Inserting into the database


            Dim strConnect As String
            strConnect = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & Server.MapPath("/data/mydb.mdb")

            Dim objConn As New OleDbConnection(strConnect)

            Dim strSQL As String
            strSQL = "INSERT INTO myTable (FirstName,LastName,Email) VALUES ('" & txtFirstName.Text & "','" & txtLastName.Text & "','" & txtEmail.Text & "')"

            Dim ObjCommand As New OleDbCommand
            With ObjCommand
                .CommandText = strSQL
                .Connection = objConn
            End With

            Try
                objConn.Open()
                ObjCommand.ExecuteNonQuery()
                lblMessage.Text = "One Record inserted."
            Catch ex As Exception
                lblMessage.Text = ex.Message
            Finally
                'closing the connection
                objConn.Close()
            End Try

        End If
    End Sub
 
Old May 26th, 2004, 08:16 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found the solution: remote server was using .Net framework 1.0 while I have .NET framework 1.1 on my machine





Similar Threads
Thread Thread Starter Forum Replies Last Post
"Invalid object format name" Error welles Crystal Reports 2 September 27th, 2006 04:42 AM
Error Old Format or invalid type Libraiy bahraman VB.NET 2002/2003 Basics 0 July 17th, 2006 08:05 AM
Error Old Format or invalid type Libraiy bahraman VB.NET 2002/2003 Basics 0 July 17th, 2006 08:02 AM
Error message: old format or invalid type library kaz .NET Framework 2.0 2 October 6th, 2004 12:39 PM
metadata error question beertv Dreamweaver (all versions) 5 November 13th, 2003 01:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.