March 30th, 2014, 08:21 AM
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=172.16.4.5;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();
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 + "')", connection2);
//SqlCommand command2 = new SqlCommand("insert into invbaldb ('sku') values ('" + reader2 + "')", connection2);
April 3rd, 2014, 11:15 PM
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
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!