Continuation question....

Discussion in 'ASP .Net' started by DC, May 24, 2005.

  1. DC

    DC Guest

    Thank you very useful.

    Just another quick question, Im now getting

    " Compiler Error Message: CS1502: The best overloaded method match for
    'System.Data.OleDb.OleDbCommand.OleDbCommand(string,
    System.Data.OleDb.OleDbConnection)' has some invalid arguments"

    When I run the following code

    string strConnectionString, strQueryString;
    strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data
    Source='C:\\Program Files\\Common Files\\ODBC\\Data
    Sources\\seminars.mdb';";

    DateTime dtAddSeminarDate = new DateTime();
    dtAddSeminarDate = DateTime.Parse(tbSeminarDate.Text);

    string AddSemSql = "INSERT INTO SeminarList (Speaker, SpeakerEmail,
    SpeakerInstitution,"
    + "SeminarTitle, SeminarDate, SeminarTime, SeminarLocation,
    SeminarDetails, SeminarHost,"
    + " SeminarHostEmail, SeminarType, OrganisationNotes)"
    + " VALUES (" + tbSpeaker.Text + "," + tbSpeakerEmail.Text + "," +
    tbSpeakerInstitution.Text +","
    + tbSeminarTitle.Text + "," + dtAddSeminarDate + "," +
    tbSeminarTime.Text + "," + tbSeminarLocation.Text + ","
    + tbSeminarDetails.Text + "," + tbSeminarHost.Text + "," +
    tbSeminarHostEmail.Text + "," + tbSeminarType.Text + "," +
    tbOrganisationNotes.Text +")";

    OleDbCommand cmd = new OleDbCommand(AddSemSql, strConnectionString);

    Any ideas?


    --
    _______________________________________________

    DC

    "You can not reason a man out of a position he did not reach through reason"

    "Don't use a big word where a diminutive one will suffice."

    "A man with a watch knows what time it is. A man with two watches is
    never sure." Segal's Law
    DC, May 24, 2005
    #1
    1. Advertising

  2. DC

    Marina Guest

    You need to pass an actual connection object in, not a connection string.

    "DC" <> wrote in message
    news:d6vhq3$l2b$...
    > Thank you very useful.
    >
    > Just another quick question, Im now getting
    >
    > " Compiler Error Message: CS1502: The best overloaded method match for
    > 'System.Data.OleDb.OleDbCommand.OleDbCommand(string,
    > System.Data.OleDb.OleDbConnection)' has some invalid arguments"
    >
    > When I run the following code
    >
    > string strConnectionString, strQueryString;
    > strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data
    > Source='C:\\Program Files\\Common Files\\ODBC\\Data
    > Sources\\seminars.mdb';";
    >
    > DateTime dtAddSeminarDate = new DateTime();
    > dtAddSeminarDate = DateTime.Parse(tbSeminarDate.Text);
    >
    > string AddSemSql = "INSERT INTO SeminarList (Speaker, SpeakerEmail,
    > SpeakerInstitution,"
    > + "SeminarTitle, SeminarDate, SeminarTime, SeminarLocation,
    > SeminarDetails, SeminarHost,"
    > + " SeminarHostEmail, SeminarType, OrganisationNotes)"
    > + " VALUES (" + tbSpeaker.Text + "," + tbSpeakerEmail.Text + "," +
    > tbSpeakerInstitution.Text +","
    > + tbSeminarTitle.Text + "," + dtAddSeminarDate + "," + tbSeminarTime.Text
    > + "," + tbSeminarLocation.Text + ","
    > + tbSeminarDetails.Text + "," + tbSeminarHost.Text + "," +
    > tbSeminarHostEmail.Text + "," + tbSeminarType.Text + "," +
    > tbOrganisationNotes.Text +")";
    >
    > OleDbCommand cmd = new OleDbCommand(AddSemSql, strConnectionString);
    >
    > Any ideas?
    >
    >
    > --
    > _______________________________________________
    >
    > DC
    >
    > "You can not reason a man out of a position he did not reach through
    > reason"
    >
    > "Don't use a big word where a diminutive one will suffice."
    >
    > "A man with a watch knows what time it is. A man with two watches is never
    > sure." Segal's Law
    >
    Marina, May 24, 2005
    #2
    1. Advertising

  3. DC

    DC Guest

    Cheers I replaced it with

    OleDbConnection Conn = new OleDbConnection(strConnectionString);

    OleDbCommand cmd = new OleDbCommand(AddSemSql, Conn);

    and its working fine now. Think Ive gone a bit codeblind :)

    Marina wrote:

    > You need to pass an actual connection object in, not a connection string.


    --
    _______________________________________________

    DC

    "You can not reason a man out of a position he did not reach through reason"

    "Don't use a big word where a diminutive one will suffice."

    "A man with a watch knows what time it is. A man with two watches is
    never sure." Segal's Law
    DC, May 24, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KathyB
    Replies:
    2
    Views:
    1,919
    Mario Vargas
    Jul 17, 2003
  2. aarthy kumar
    Replies:
    3
    Views:
    385
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Oct 12, 2005
  3. TheDustbustr

    stackless python: continuation module?

    TheDustbustr, Jul 25, 2003, in forum: Python
    Replies:
    2
    Views:
    457
    Christian Tismer
    Aug 6, 2003
  4. Sandra-24
    Replies:
    5
    Views:
    408
    Leif K-Brooks
    Apr 9, 2006
  5. Replies:
    1
    Views:
    4,264
    Joe Kesselman
    Aug 2, 2006
Loading...

Share This Page