CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2014

    Copy Data From OdbcConnection to SQLStatment Thru C# Code

    I want to copy my data from OdbcConnection to SqlStatment thru C# code. Thru one button I want to do this...
    I'm not much expert in c# but just little bit programming, can some one add/edit some codes our statement/help so i can complete my program.

    I do thru this code but data is not fetching....

    protected void Button1_Click(object sender, EventArgs e)
    this.cn = new OdbcConnection();
    this.Jda_Cmd = new OdbcCommand();
    this.Jda_Cmd.Connection = this.cn;
    this.cn.ConnectionString = "DSN=Imports_Img;UserID=ODBCCOMN;Password=pkli7491;Data Source=;Transport Product=Client Access;SSL=DEFAULT;DEFAULT COLLECTION='BINDAWOOD'";
    string str = ("SELECT ibhand FROM MM410LIB.INVBAL WHERE INUMBR = 79610 AND ISTORE=14");
    this.Jda_Cmd.CommandText = str;

    OdbcDataReader reader2 = this.Jda_Cmd.ExecuteReader();
    while (reader2.Read())
    this.DB_Cmd = new SqlCommand();
    this.DB_Cmd.Connection = this.DB_cn;
    SqlConnection connection2 = new SqlConnection();
    SqlCommand db_cn = new SqlCommand ("insert into invbaldb ('sku') values ('" + reader2[0] + "')", connection2);
    //SqlCommand command2 = new SqlCommand("insert into invbaldb ('sku') values ('" + reader2[0] + "')", connection2);

  2. #2
    Join Date
    Apr 2014

    Re: Copy Data From OdbcConnection to SQLStatment Thru C# Code


    Sorry that I can't figure out what's happening with your codes since Im toally a beginner with C#.
    But I'd like to share you with some useful site like http://exportdata.codeplex.com/,which presents How to Export Data to SQL using a data processing library.
    Hope it can do you a bit favor.


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)