cgeier 187 Junior Poster

Try the following:

Create your user controls:

  • Click "File"
  • Select "New"
  • Select "Project"
  • Click "Visual C#"
  • Select "Windows"
  • Select "Windows Forms Control Library"
  • Change "Name" as desired (ex: "MyUserControls"
  • Click "OK"

Add second UserControl:

  • Click "Project"
  • Select "Add New Item"
  • Select "User Control"
  • Click "Add"

When following the tutorial

How to pass data between two forms in C#

do the following:

In "UserControl1.cs":

  • Add "ScheduleInfo.cs" code
  • Add "ValueUpdatedEventArgs.cs" code
  • Add "ChildFrm.cs" code to "UserControl1.cs"
  • Add any desired controls to "UserControl1"

UserControl2:

  • Add label named "label1"

In "UserControl2.cs" add the following code:

public void SetLabel1Text(string userValue)
{
    this.label1.Text = userValue;
}//SetLabel1Text

Build Windows Forms Control Library project (ex: "MyUserControls")

  • Click "Build"
  • Click "Build MyUserControls"

Create a Windows Forms Application project:

  • Click "File"
  • Select "New"
  • Select "Project"
  • Click "Visual C#"
  • Select "Windows"
  • Select "Windows Forms Application"
  • Change "Name" as desired (ex: "UserControlPassData")
  • Click "OK"

If desired, add second form:

  • Click "Project"
  • Select "Add New Item"
  • Select "Windows Form"
  • Click "Add"

Add user controls to Toolbox:

  • Click "View"
  • Click "ToolBox"
  • Right-click in ToolBox
  • Select "Choose Items..."
  • Click ".NET Framework Components"
  • Click "Browse" button
  • Choose your Windows Forms Control Library dll (ex: "MyUserControls.dll")
  • Click "Open"
  • Click "OK"

Add "UserControl1" to "Form1"

  • Click "View"
  • Click "ToolBox"
  • Click "UserControl1"
  • Click on "Form1" (to add control to Form1)

Add "UserControl2" using the same process as used to add "UserControl1".

Note: If adding UserControl2 to "Form2", then right-click on "UserControl2" and select "Properties". Change "Modifiers" …

ddanbe commented: For the good work! :) +15
cgeier 187 Junior Poster

See the following tutorial:
How to pass data between two forms in C#

cgeier 187 Junior Poster

What version of VS? What version of .NET? Are both UserControls being used on the same form or different forms? Do you have some screen shots?

I'm confused by "I am trying retain the original instance so that a new instance will not block my original user control instance." Please provide more details.

cgeier 187 Junior Poster

So you want Table2 to be a copy of Table1? Why don't you delete all the data from Table2 and then use "Select Into".

SQL SELECT INTO Statement

Inserting Rows by Using SELECT INTO

cgeier 187 Junior Poster
cgeier 187 Junior Poster

Try surrounding string values with single quotes. Or better yet, use parameters. Search for parameterized queries.

cgeier 187 Junior Poster

The following was tested on Outlook 2010:

If you've already added the .pst files you want, do the following:

Version 1 (.pst manually added):

Private Sub getOutlookEmailInfo()
    Dim output As String = String.Empty
    Dim olApp As Outlook.Application = Nothing
    Dim olNameSpace As Outlook.NameSpace = Nothing

    'create new instance of Outlook.Application
    olApp = New Outlook.Application()

    'set olNameSpace to MAPI namespace
    olNameSpace = olApp.GetNamespace("MAPI")

    ' TODO: Replace the "YourValidProfile" 
    ' and "myPassword" with Missing.Value 
    ' if you want to log on with the default profile.
    ' olNameSpace.Logon("YourValidProfile", "myPassword", True, True)
    ' olNameSpace.Logon()


    'loop through stores
    For Each oStore As Outlook.Store In olNameSpace.Stores

        'root folder for store
        Dim rootFolder As Outlook.MAPIFolder = oStore.GetRootFolder()

        'folders for store
        Dim subFolders As Outlook.Folders = rootFolder.Folders

        'loop through all folders
        For Each oFolder As Outlook.Folder In subFolders

            'get folder items
            Dim oItems As Outlook.Items = oFolder.Items

            'search through each email
            For Each email As Object In oItems

                'make sure item is a mail item,
                'not a meeting request
                If email.MessageClass = "IPM.Note" Then
                    If TypeOf email Is Microsoft.Office.Interop.Outlook.MailItem Then
                        output += "oStore: " + oStore.DisplayName + " oFolder: " + oFolder.Name + " " + "subject: " & email.Subject & System.Environment.NewLine
                    End If
                End If
            Next
        Next
    Next

    'olNameSpace.Logoff()

    olNameSpace = Nothing
    olApp = Nothing

    MessageBox.Show(output)

End Sub

Version 1 Usage:

getOutlookEmailInfo()

If you want to programmatically add the .pst files.

Version 2 (.pst filename specified, display name not specified, .pst added programmatically):

Private Sub getOutlookEmailInfo(ByVal pstList As List(Of String))
    Dim output …
cgeier 187 Junior Poster

Add reference to "Microsoft Outlook xx.x Object Library" (where xx.x = 14.0, 12.0, etc):
* Click "Project"
* Select "Add Reference"
* Click "COM"
* Select "Microsoft Outlook 14.0 Object Library"

Add Imports statement:

  • Imports Outlook = Microsoft.Office.Interop.Outlook;

getContacts:

Private Sub getContacts()

    'create new instance of Outlook.Application
    Dim outlookApp As Outlook.Application = New Outlook.Application()

    'create new instance of Outlook.MAPIFolder
    Dim outlookMapiFolder As Outlook.MAPIFolder = Nothing

    'create new instance of Outlook.Items
    Dim outlookItems As Outlook.Items = Nothing

    'set outlookMapiFolder to Contacts folder
    outlookMapiFolder = outlookApp.GetNamespace("MAPI").GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)

    'get items from contacts
    outlookItems = outlookMapiFolder.Items


    For i As Integer = 0 To outlookItems.Count - 1

        Dim contact As Outlook.ContactItem = outlookItems(i + 1)


        Dim entryId As String = contact.EntryID
        Dim fullName As String = contact.FullName
        Dim companyName As String = contact.CompanyName
        Dim email1Address As String = contact.Email1Address
        Dim email1AddressType As String = contact.Email1AddressType
        Dim businessTelephoneNumber As String = contact.BusinessTelephoneNumber
        Dim homeTelephoneNumber As String = contact.HomeTelephoneNumber
        Dim mobileTelephoneNumber As String = contact.MobileTelephoneNumber

        'add any additional entries that you want to retrieve



        'add entryId and fullName to dataGridView1
        'where DataGridView1 is a DataGridView with
        'columns "entryId" and "fullName"
        DataGridView1.Rows.Add(entryId, fullName)

    Next
End Sub

Resources:
Adapted from: Get Outlook Contacts in to C# form based Application

Outlook Object Model Overview

cgeier 187 Junior Poster

Also what is your connection string (conOdbc)?

cgeier 187 Junior Poster

I don't have much experience with DB2, but found the following:

Client Access ODBC: Common External Stored Procedure Errors

Error: [DB2/400 SQL]SQL0204 - in type *N not found

This error is generated when preparing or running a stored procedure if the call uses parameter markers and the server is unable to find a valid declaration of the stored procedure. As mentioned in "defining stored procedures" section, if a stored procedure call uses parameter markers then the procedure must be defined. This applies even if the application does not describe the parameter. If CREATE PROCEDURE was used, run a query over QSYS2/SYSPROCS to verify the create procedure was run correctly. SPECIFIC_SCHEMA and ROUTINE_SCHEMA must match the library used on the call in the PC application. EXTERNAL_NAME must resolve to the actual program name. The parameter descriptions must also be correct. The SQLProcedures and SQLProcedureColumns ODBC APIs can also be used to retrieve the catalog information. If the older DECLARE PROCEDURE was used, then you must use extended dynamic support to return output or input output parameters. The call of the stored procedure must be stored in the active package. Use PRTSQLINF on the package to verify its contents. Delete the SQL package after making any change to declare procedure. Parameter descriptions are stored in the package as part of the call entry, not the declare entry. DECLARE PROCEDURE takes precedence over CREATE PROCEDURE. Delete the package if the problem persists. Changes to the SQL PATH job setting at V4R5M0 …

cgeier 187 Junior Poster

If you want anyone to help, you need to provide your code.

cgeier 187 Junior Poster

Wmi is for computers running Windows. You need to provide more info about your devices and environment.

cgeier 187 Junior Poster

The above assumes that your program is running on each client pc.

cgeier 187 Junior Poster

Use wmi to get the relevant info (mac address, ip address, etc) and send that info wherever you want to send it.

cgeier 187 Junior Poster

It's best to post your code, as some people don't want to download unknown files to their computer.

Your original code:

Module Module1
    Sub Main()
        'Declarations
        Dim intC As Integer = 0
        Dim intF As Integer = 0
        'Display 
        Console.WriteLine("C                 F")
        Console.Read()

        Do
            If intC > 100 Then
                intF = CInt((9 / 5 * intC + 32))
                Console.WriteLine(intC & "           " & intF)
                intC = intC + 10
            End If
        Loop Until (intC > 100)
    End Sub
End Module

Issues:

You have If intC > 100. This will never occur, because all of your calculations are inside the if statement and intC is 0. This if statement is unnecessary because the loop condition will do everything you need. If you choose to keep it, change it to If intC < 100. Right now you have an infinite loop, because "intC" is always < 100.

You have Console.Read before the loop. This will wait for input. You may want to put this after the loop, if your intent is to keep the window open until the user presses a key.

Note: You can use "Console.WriteLine" statements to help you debug your program. See below for example.

This is your original code with "Console.WriteLine" statements inserted for debugging purposes:

Module Module1
    Sub Main()
        'Declarations
        Dim intC As Integer = 0
        Dim intF As Integer = 0
        'Display 
        Console.WriteLine("C                 F")

        'used for debugging
        Console.WriteLine("Before console.read")

        Console.Read()

        Do
            'used for debugging
            Console.WriteLine("in loop. before if. intC=" & intC)

            If intC > …
cgeier 187 Junior Poster

What os? Is the C drive where the os resides? If so, it's not a good idea to share the os drive to everyone even on your home network. What are you trying to accomplish?

cgeier 187 Junior Poster

A valid e-mail address contains "@" (ex: username@domain). I don't see that in your post.

cgeier 187 Junior Poster

I don't understand what you are looking for. What do you mean by "but also the pst(s) that is loaded in the outlook"? Maybe you can post a screen shot and then a description based on the screenshot. Also are you trying to do this for all users (on a computer) or only the currently logged in user?

cgeier 187 Junior Poster

I noticed that you have the following in your code: Dim dbdataset As New DataTable. The name "dbdataset" is a little misleading, because you define it as a DataTable, not a DataSet.

It is better to create a Module to declare your connection string in, which all of the other forms can use. Then if any of the information changes, you only have to change it once.

Module1.vb

Module Module1
    Public connectStr = "server=localhost;userid=root;password='';database=doctorsuite"

End Module

You can also reset the DataTable, before filling it again:

Private dbDataTable As New DataTable

        ...

Private Sub datagridview_load()

    'prevent duplicates
    DataGridView1.DataSource = Nothing

    If dbDataTable.IsInitialized Then
        dbDataTable.Reset()
    End If

    Dim mysqlconn As New MySqlConnection
    mysqlconn.ConnectionString = connectStr

    Dim sda As New MySqlDataAdapter

    Dim bsource As New BindingSource

        ...

    Try

        ...

    Catch ex As MySqlException
        MessageBox.Show(ex.Message)
    Catch ex As Exception
        MessageBox.Show(ex.Message)
    End Try

End Sub

Additionally, it is best to use parameterized queries. See this post for more info.

cgeier 187 Junior Poster

Try adding the following: DataGridView1.DataSource = Nothing to datagridview_load

    Public Sub datagridview_load() 'Loads the data into the datagrid table'

           'prevents duplicates
           DataGridView1.DataSource = Nothing

           mysqlconn = New MySqlConnection
            mysqlconn.ConnectionString = "server=localhost;userid=root;password='';database=doctorsuite"
           Dim sda As New MySqlDataAdapter

          Dim bsource As New BindingSource

                ...
    End Sub
cgeier 187 Junior Poster

Please post some code and some more information. Are you adding the data using datagridview? Or on another form?

cgeier 187 Junior Poster

In line 43, remove "ByVal".

Changing from:

lRet = SystemParametersInfo _
           (SPI_SETSCREENSAVETIMEOUT, lSeconds, ByVal 0&, _
             SPIF_UPDATEINIFILE + SPIF_SENDWININICHANGE)

To:

lRet = SystemParametersInfo _
           (SPI_SETSCREENSAVETIMEOUT, lSeconds, 0&, _
             SPIF_UPDATEINIFILE + SPIF_SENDWININICHANGE)

works for me.

cgeier 187 Junior Poster

It is difficult to say why your program doesn't run, without knowing anything about your program. It is best to contact the developer. If you are the developer, provide more info about your program.

cgeier 187 Junior Poster

You might have better luck in the "Visual Basic 4/5/6" forum. You may want to include the version of Excel that you are using. Some sample data is also beneficial.

Visual Basic for Applications

"Visual Basic for Applications (VBA) is an implementation of Microsoft's event-driven programming language Visual Basic 6..."

"...Compatibility ends with Visual Basic version 6; VBA is incompatible with Visual Basic .NET (VB.NET)..."

cgeier 187 Junior Poster

It is most likely "ToString".

Delete ".ToString()" and ".ToString" from each line.

example:

Change from:

grade = Me.DataGridView1.Rows(i).Cells("grade").Value.ToString()

To:

grade = Me.DataGridView1.Rows(i).Cells("grade").Value

I'm not sure what your columns represent, but it appears to not be normalized. To learn more about dateabase normalization, search for "database normalization".

cgeier 187 Junior Poster

VBA is not VB .NET.

Visual Basic for Applications

cgeier 187 Junior Poster

What database? Post more of your code.

cgeier 187 Junior Poster

movementClass.cs:

Add the following "using" statements:

using System.Drawing; and
using System.Windows.Forms;

public static class movementClass 
{
    public static void moveLeft(PictureBox moveBox)
    {
        Point p = moveBox.Location;
        p.X -= 20;
        moveBox.Location = p;
    }

    public static void moveDown(PictureBox moveBox)
    {
        Point p = moveBox.Location;
        p.Y += 20;
        moveBox.Location = p;
    }
}

Then in Form1.cs:

private void downBut_Click(object sender, EventArgs e)
{
    movementClass.moveDown(moveBox);
}

private void leftBut_Click(object sender, EventArgs e)
{
    movementClass.moveLeft(moveBox);
}
cgeier 187 Junior Poster
cgeier 187 Junior Poster

My opinion is that you should only maintain a resource as long as you need it. I recommend seeing the tutorial on form to form communication if you have data that is passed between forms. Also, close/dispose of objects you are not actively using. When an application/program makes users computers unresponsive due to poor programming practices the users will likely stop using your program.

cgeier 187 Junior Poster

Try the following:

Boot into Safe Mode, then

  • Click "Start"
  • Select "Control Panel"
  • For View by, select "Small Icons" (or Large Icons)
  • Click "System"
  • Click "Advanced System Settings"
  • Do you want to allow the following program to make changes...? Click, "Yes"
  • Click "Advanced" tab
  • Under "Startup and Recovery", click "Settings"
  • Under "System failure", uncheck "Automatically restart"
  • Click "OK"
  • Click "OK"
  • Reboot computer.

If it successfully boots, you may see an error message which should help you identify what is causing the error.

cgeier 187 Junior Poster

It's in "javax.swing.JList".

See the documentation for more info:
JList

cgeier 187 Junior Poster
cgeier 187 Junior Poster

I think that you may need to use Command Line Processor Plus (CLPP) from IBM Data Server Driver Package.

To download and install:
IBM Support Fix Central

Method 1:

  • Click "Select product" tab
  • For "Product Group", select "Information Management"
  • For "Select from Information Management", select "IBM Data Server Client Packages"
  • For "Installed Version", select "10.5.*"
  • For "Platform", select "Windows"
  • Click "Continue"
  • Click "Continue" (Browse for fixes radio button should be checked by default)

Method 2:

  • Click "Find product" tab
  • For "Product selector", ente "Information Management"
  • For "Product selector " enter "IBM Data Server Client Packages"
  • For "Installed Version", select "10.5.*"
  • For "Platform", select "Windows"
  • Click "Continue"
  • Click "Continue" (Browse for fixes radio button should be checked by default)

Download and install "IBM Data Server Driver Package":

For 32-bit:
Download and install "IBM Data Server Driver Package (Windows/x86-32 32 bit) V10.5 Fix Pack 3

For 64-bit:
Download and install "IBM Data Server Driver Package (Windows/x86-64 64 bit) V10.5 Fix Pack 3

After installation, DB2 Command Line Processor Plus can be found in:

(for Win 7):

  • Start
  • All Programs
  • IBM DB2 DB2COPY1 (or IBM DB2...))
  • DB2 Command Line Processor Plus

or

  • Start
  • All Programs
  • Accessories
  • Command Prompt
  • Type: clpplus

Note: clpplus runs "C:\Program Files\IBM\SQLLIB\BIN\clpplus.bat" (for 32-bit)

Then:

SQL> connect user1/'YourPassword'@127.0.0.1:50000/sample

where
user1 = you user name
YourPassword = your password
127.0.0.1 = your IP address
50000 = port number
sample = database name

cgeier 187 Junior Poster

That syntax is for DB2 Command Line Processor Plus. You are trying to use it in DB Command Line Processor. They are two different tools.

When using DB2 Command Line Processor Plus you will see: SQL>

When using DB2 Command Line Processor you will see: db2=>

cgeier 187 Junior Poster

After installation, DB2 Command Line Processor Plus can be found in:

(for Win 7):
* Start
* All Programs
* IBM DB2...
* DB2 Command Line Processor Plus

cgeier 187 Junior Poster

Use command line processor (CLP) from IBM Data Server Runtime Client or Command line process plus (CLPP) from IBM Data Server Driver Package

See also:

IBM Knowledge Center

  • Click "Database fundamentals"
  • Click "Installing"
  • Click "Installing IBM Data Server drivers and clients"

Additional info:

  • Click "Developing code for accessing and managing data"
  • Click "Database applications"
    See desired links (ADO.NET, OLE DB, etc...)

To connect in DB2 Command Line Processor Plus:

SQL> connect user1/'YourPassword'@127.0.0.1:50000/sample

where:
user1 = you user name
YourPassword = your password
127.0.0.1 = your IP address
50000 = port number
sample = database name

cgeier 187 Junior Poster

Here are multiple ways of retrieving data from DB2. They were tested using the express version of DB2.

See previous post on installing appropriate packages and adding reference to "IBM.Data.DB2" and imports statement: Imports IBM.Data.DB2

In the following examples, I will use the following:

  • Schema name: HR
  • Database name: Sample
  • IP Address: 127.0.0.1
  • Port: 50000

Version 1 & version 2 are preferred methods.

Version 1: (using DB2Connection and DB2DataAdapter)

  • Add Imports IBM.Data.DB2

    Private Sub readDataFromDB2NETv1()
        Dim connectStr As String
        Dim sqlText As String
        Dim conn As New DB2Connection
    
        'without TrustedContext
        connectStr = "Database=Sample;Server=127.0.0.1:50000;Uid=db2admin;Pwd=nopass;"
        'connectStr = "Database=Sample;Server=127.0.0.1:50000;UserID=db2admin;Password=nopass;"
    
        'if TrustedContext has been set up
        'connectStr = "Database=Sample;Server=127.0.0.1:50000;UserID=db2admin;Password=nopass;TrustedContextSystemUserID=masteruser;TrustedContextSystemPassword=masterpassword"
    
    
        Try
    
            conn = New DB2Connection(connectStr)
            conn.Open()
    
            sqlText = "Select * from HR.Employee"
    
            Dim da As New DB2DataAdapter(sqlText, conn)
    
            Dim rowsRetrieved As Integer
            Dim output As String = String.Empty
    
            Dim dt As DataTable = New DataTable()
    
            'fill DataTable
            rowsRetrieved = da.Fill(dt)
    
            'close connection
            conn.Close()
    
            For Each row As DataRow In dt.Rows
                Dim col0 As String = row(0).ToString()
                Dim col1 As String = row(1).ToString()
                Dim col2 As String = row(2).ToString()
    
                output += col0 & " " & col1 & " " & col2
                output += System.Environment.NewLine
            Next
    
            MessageBox.Show(output)
    
        Catch ex As DB2Exception
            MessageBox.Show(ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
    

Version 2 (using DB2Connection and DB2DataReader):

  • Add Imports IBM.Data.DB2

    Private Sub readDataFromDB2NETv2()
        Dim connectStr As String
        Dim sqlText As String
        Dim conn As New DB2Connection
    
        'without TrustedContext
        'connectStr = "Database=Sample;Server=127.0.0.1:50000;Uid=db2admin;Pwd=nopass;"
        connectStr = "Database=Sample;Server=127.0.0.1:50000;UserID=db2admin;Password=nopass;"
    
        'if TrustedContext has been set up
        'connectStr …
cgeier 187 Junior Poster

Go to IBM Fix Central website:
Fix Central

Click "Find Product" tab
In "Product Selector", enter IBM Data Server Client Packages
For "Installed Version", select 10.5.*
For "Platform", select Windows
Click Continue
Select Browse for fixes radio button
Click Continue

Download and install fix pack that says "IBM Database Add-Ins for Visual Studio"

May also need to download/install "IBM Data Server Driver Package (Windows/x86-32 32bit) V10.5 Fix Pack 3" for 32-bit OS. Or "IBM Data Server Driver Package (Windows/x86-64 64bit) V10.5 Fix Pack 3"

Add Reference:

  • Click "Project" (in menu)
  • Select "Add Reference"
  • Select "Add Reference"
  • Select ".NET"
  • Select "IBM.Data.DB2"
  • Click "OK"

Add Imports IBM.Data.DB2

Try the following:

        Dim connectStr As String
        Dim sqlText As String
        Dim conn As New DB2Connection

        connectStr = "Database=Sample;Server=127.0.0.1:50000;Uid=db2admin;Pwd=yourpass;"


        conn = New DB2Connection(connectStr)
        conn.Open()


        sqlText = "Select * from SchemaName.Employee"

        Dim cmd As New DB2Command(sqlText, conn)

Where "127.0.0.1" is your IP address, and "50000" is your port number, and "SchemaName" is your desired schema name (ex: user1)

cgeier 187 Junior Poster

Thanks for the explanations.

cgeier 187 Junior Poster

The username could remain anonymous when showing the comment. However it may be difficult to ensure a useful comment has been left.

cgeier 187 Junior Poster

The following seems to work to view e-mail subjects (from Inbox):

Add Reference to Microsoft Outlook xx.x Object Library (where xx.x is a number: 12.0, 14.0, etc)

  • Click "Project" (in menu)
  • Select "Add Reference"
  • Click "COM"
  • Select "Microsoft Outlook 14.0 Object Library"

Add Imports Outlook = Microsoft.Office.Interop.Outlook

    Private Sub getOutlookEmailInfo()

        Dim outlookapp As Outlook.Application = New Outlook.Application()
        Dim olNameSpace As Outlook.NameSpace = outlookapp.GetNamespace("MAPI")

        ' TODO: Replace the "YourValidProfile" and "myPassword" with 
        'Missing.Value if you want to log on with the default profile.
        'olNameSpace.Logon("YourValidProfile", "myPassword", True, True)
        'olNameSpace.Logon()

        Dim oInbox As Outlook.MAPIFolder = olNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
        Dim oItems As Outlook.Items = oInbox.Items

        Dim output As String = String.Empty
        For Each email As Outlook.MailItem In oItems
            output += "subject: " & email.Subject & System.Environment.NewLine
        Next

        MessageBox.Show(output)

    End Sub

Resources:
Reading e-mail without Outlook app open

Looping over Outlook mail items in "Sent Items" folder

How to use the Microsoft Outlook Object Library to create an Outlook contact in Visual Basic .NET

How to automate Outlook by using Visual Basic

cgeier 187 Junior Poster

Installing IBM Data Server drivers and clients

The following is for C#, but can be easily translated to VB .NET:

Connection to DB2 from .NET

cgeier 187 Junior Poster

Use a "Sub".

Functions and subroutines

"...Subroutines are useful because they eliminate redundancy..."

cgeier 187 Junior Poster

Please add a feature that requires a short explanation for a down-vote. It is not beneficial to see that a post was down-voted without knowing why.

cgeier 187 Junior Poster

Why was my post down-voted? It is a tested/working solution. If you disagree with my solution, please provide explanation.

cgeier 187 Junior Poster

The poster stated she is using DB2, not SQL Server.

SqlConnection Class
Represents an open connection to a SQL Server database

Use ODBC or OleDB.

Connection Strings

cgeier 187 Junior Poster

Page_Load is an event handler. It shouldn't be defined more than once.

cgeier 187 Junior Poster

Did you try the following?

  • Click "Project" (in menu bar)
  • Select "Add Reference"
  • Click ".NET" tab
  • Select "Microsoft.Office.Interop.Outlook" (version 14.0.0.0)
  • Click "OK"
cgeier 187 Junior Poster

I am able to replicate this error if I enter:

 Protected Sub Page_Load(ByVal sender As Object, _
    ByVal e As System.EventArgs)

End Sub

 Protected Sub Page_Load(ByVal sender As Object, _
    ByVal e As System.EventArgs)

End Sub

In the above code this error occured because it is defined more than once without changing the number of parameters.