Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
L

L sup2 D

@L sup2 D
About
Posts
5
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Database upload and Append
    L L sup2 D

    Rob, the following is my code...still having problems. Could you please take a look? :sigh: :^) OleDbConnection con = new OleDbConnection(strConnection); OleDbConnection con2 = new OleDbConnection(strConnection2); con.Open(); con2.Open(); string strSQL = "INSERT INTO First_Table([OID]) values (@OID)"; string strSQL2 = "Select [OID] From First_Table"; OleDbCommand cmd2 = new OleDbCommand(strSQL2,con2); OleDbCommand cmd = new OleDbCommand(strSQL,con); OleDbDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { try { cmd.Parameters.Add (new OleDbParameter("OID",dr[0].ToString())); cmd.ExecuteReader(); } catch (Exception err) { string str=err.Message; bNoError=false; } finally { if (con.State.ToString() == "Open") con.Close(); if (con2.State.ToString() == "Open") con2.Close(); }

    L²+D

    Database csharp help database visual-studio question

  • Database upload and Append
    L L sup2 D

    It probably is a C# question, but as I said, I am new to all this and for me; it has to do with databases as well as the code behind. I don't know who gave you one point, but a little code for pointing in the right direction would have helped. Thanks. :^) :confused:

    L²+D

    Database csharp help database visual-studio question

  • Database upload and Append
    L L sup2 D

    Thanks for your help Rob, but I am not exactly sure where this code would go; after the dset is defined or ??? Also, the insert into (f1,f2,f3) values (?,?,?)" I want to copy all columns, can I put insert into (*)" and leave off values? Sorry to be such a pain, but like I said, I am REALLY new to this and still shakey on my feet (code :o) Thank you again for being such a help to such a bother :-D :rose:

    L²+D

    Database csharp help database visual-studio question

  • Database upload and Append
    L L sup2 D

    Hi Rob, as I said, I am new to this so here is what I have done; private bool uploadData(string myPath, string txtUpload) { bool bNoError = true; string strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" +myPath +txtUpload +";"; OleDbConnection con = new OleDbConnection(strConnection); con.Open(); try { DataSet dsEWEtmp = new DataSet(); OleDbDataAdapter daEWEForm = new OleDbDataAdapter("SELECT * FROM Some_Form", con); int updates = daEWEForm.Fill(dsEWEtmp, "Some_Form"); foreach (DataRow dataRow in dsEWEtmp.Tables) { dsEWEtmp.Tables[0].ImportRow(dataRow); dsEWEtmp.Tables[0].AcceptChanges(); } updates = daEWEForm.Update(dsEWEtmp); // return dsEWEtmp; DataTable tblEWEForm; tblEWEForm = dsEWEtmp.Tables[0]; OleDbCommandBuilder objCommandBuilder = new OleDbCommandBuilder(daEWEForm); daEWEForm.Update(dsEWEtmp, "Some_Form"); } catch(Exception err) { string str = err.Message; bNoError = false; } finally { if (con.State.ToString() =="Open") { con.Close(); } } return bNoError; As I stated I have the file that I upload; then if there is an uploaded file, it is "supposed" to read that file into a dataset and write it to the master database. In my web.config file, the master database resides at strConnection2, the uploaded file is at strConnection. I am really confused how to access them both, one to get the data from the uploaded file and two connect to the master database and write to it. Is that better? Please help if you can. Thanks!:confused:

    L²+D

    Database csharp help database visual-studio question

  • Database upload and Append
    L L sup2 D

    Hi, I am trying to upload a database (which I have no problem doing), then I need to take that database and append it to a master database with the same tables and structure. I am using Access and visual studio .net, C#. I have tried everything, I am new to C# and .net and so maybe I am not putting things in the correct order or something?? Specifically, I have to use two different connections to get to the data, one connection where the data is located (conn1), and then append that data to the master database, (conn2). Please help if you can! :mad::confused: :((

    L²+D

    Database csharp help database visual-studio question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups