Click here to Skip to main content
15,898,035 members
Home / Discussions / C#
   

C#

 
GeneralRe: MSDE 2000 Pin
theStorminMormon1-Sep-05 6:14
theStorminMormon1-Sep-05 6:14 
Questionmaster volume control in c# Pin
richard sheldon1-Sep-05 3:10
richard sheldon1-Sep-05 3:10 
QuestionRemove system tray icon of a killed process Pin
hakanaktan1-Sep-05 2:35
hakanaktan1-Sep-05 2:35 
QuestionWaitForExit Pin
Loveday781-Sep-05 2:27
Loveday781-Sep-05 2:27 
AnswerRe: WaitForExit Pin
S. Senthil Kumar1-Sep-05 6:16
S. Senthil Kumar1-Sep-05 6:16 
GeneralRe: WaitForExit Pin
Loveday781-Sep-05 20:43
Loveday781-Sep-05 20:43 
GeneralRe: WaitForExit Pin
therealmccoy2-Sep-05 7:51
therealmccoy2-Sep-05 7:51 
QuestionCopying data from Oracle to Access Pin
oliver@GVA1-Sep-05 1:35
oliver@GVA1-Sep-05 1:35 
Hi!

I'm trying to copy data from Oracle to Access 2000. For this project, I'm not allowed to use ADO.NET 2.0 unfortunately (BulkCopy would really help me), so I'm trying to do it by myself. My idea is to create a DataSet with the data of Oracle, and to push it in my Access database. For this I use the "DataSet.Merge" method and then the "DataAdapter.Update" method to write down the data. I don't have any error coming out, but nothing is written in the Acces DB.
Has someone met the same problems??
Has someone a better solution??


Many thanks in advance.

I join a copy of my code too :

using System;
using System.Data;
using System.Data.Odbc;

namespace consoOracle
{
///
/// Test connexion à Oracle
///

class afficheData
{
private OdbcDataAdapter da;
private DataSet ds;

int scr_no = 905;

public afficheData()
{
lireDataDsOracle();
ecrireDataDsAccess();
}

public void lireDataDsOracle()
{
//1. connexion à Oracle
System.Data.Odbc.OdbcConnection connOra;
connOra = new System.Data.Odbc.OdbcConnection();
connOra.ConnectionString = "DSN=ORA;Uid=uid;Pwd=pwd;";

try
{
//2. préparer une requète
string rqt = "Select LOC_C_LIBELLE_LONG As LOC_C_NOMLOCAL, "
+ "LOC_C_LIBELLE_COURT As LOC_C_NOMLOCALABREGE "
+ "From GEVI_T_LOCAL "
+ "Where LOC_SCR_N_ID = "+scr_no;

OdbcCommand cmd = new OdbcCommand(rqt, connOra);

da = new OdbcDataAdapter();
da.SelectCommand = cmd;

//3. ouvrir la connexion
connOra.Open();

//4. remplir le DataSet
ds = new DataSet();
da.Fill(ds, "Locaux");
// Console.WriteLine(ds.GetXml());
Console.WriteLine("C'est lu");
}
finally
{
//6. fermer tout
connOra.Close();
}
} //lireDataDsOracle()

public void ecrireDataDsAccess()
{
//1. connexion à Access
System.Data.Odbc.OdbcConnection connAcc;
connAcc = new System.Data.Odbc.OdbcConnection();
connAcc.ConnectionString = "DSN=ACC";

try
{
//2. préparer une requète
string rqt = "Select LOC_C_NOMLOCAL, "
+"LOC_C_NOMLOCALABREGE "
+"From GIDE_T_LOCAUX";
OdbcCommand cmd = new OdbcCommand(rqt, connAcc);

OdbcDataAdapter daAcc;
DataSet dsAcc;
daAcc = new OdbcDataAdapter();

daAcc.SelectCommand = cmd;

//3. ouvrir la connexion
connAcc.Open();

//4. remplir le DataSet
dsAcc = new DataSet();
daAcc.Fill(dsAcc, "Locaux");

//5. Merge
dsAcc.Merge(ds);
dsAcc.AcceptChanges();

//6. Ecriture
rqt = "Insert Into GIDE_T_LOCAUX ("
+"LOC_C_NOMLOCAL, "
+"LOC_C_NOMLOCALABREGE) "
+"Values ('@nom', '@nomAbrege'"
+")";
cmd = new OdbcCommand(rqt, connAcc);
cmd.Parameters.Add("@nom", OdbcType.NVarChar, 22, "LOC_C_NOMLOCAL");
cmd.Parameters.Add("@nomAbrege", OdbcType.NVarChar, 22, "LOC_C_NOMLOCALABREGE");


daAcc.InsertCommand = cmd;

try
{
daAcc.Update(dsAcc,"Locaux");
Console.WriteLine("Insertion OK");
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
}

Console.WriteLine(dsAcc.GetXml());
Console.WriteLine("C'est fini");

}
finally
{
//6. fermer tout
connAcc.Close();
}
} //ecrireDataDsAccess()

[STAThread]
static void Main()
{
new afficheData();
} //Main
}
}
QuestionCombobox Tag Pin
PHDENG811-Sep-05 1:30
PHDENG811-Sep-05 1:30 
AnswerRe: Combobox Tag Pin
Mohamad Al Husseiny1-Sep-05 2:43
Mohamad Al Husseiny1-Sep-05 2:43 
GeneralRe: Combobox Tag Pin
PHDENG811-Sep-05 4:22
PHDENG811-Sep-05 4:22 
GeneralRe: Combobox Tag Pin
mav.northwind1-Sep-05 6:35
mav.northwind1-Sep-05 6:35 
GeneralRe: Combobox Tag Pin
Mohamad Al Husseiny1-Sep-05 8:16
Mohamad Al Husseiny1-Sep-05 8:16 
QuestionCurves and Angles Pin
suresh sahu1-Sep-05 1:22
suresh sahu1-Sep-05 1:22 
AnswerRe: Curves and Angles Pin
Andrew Kirillov1-Sep-05 3:09
Andrew Kirillov1-Sep-05 3:09 
GeneralRe: Curves and Angles Pin
Nageshwar Rao1-Sep-05 5:56
Nageshwar Rao1-Sep-05 5:56 
GeneralRe: Curves and Angles Pin
Anonymous1-Sep-05 5:56
Anonymous1-Sep-05 5:56 
QuestionInterbase databse Pin
Virendrak1-Sep-05 1:02
Virendrak1-Sep-05 1:02 
QuestionProblem in Viewing data from DataGrid Pin
Dhruvesh Brahmbhatt1-Sep-05 0:44
Dhruvesh Brahmbhatt1-Sep-05 0:44 
QuestionSorting a DataView by an int[] list Pin
thomasa31-Aug-05 21:52
thomasa31-Aug-05 21:52 
AnswerRe: Sorting a DataView by an int[] list Pin
thomasa31-Aug-05 22:51
thomasa31-Aug-05 22:51 
QuestionMS Word add-in install problem Pin
parviz_rashidi31-Aug-05 21:17
parviz_rashidi31-Aug-05 21:17 
QuestionHow can I link a listbox to a picturebox in C#.net?please help... Pin
azizkhani31-Aug-05 20:41
azizkhani31-Aug-05 20:41 
QuestionPlease help.. Pin
KORCARI31-Aug-05 19:30
KORCARI31-Aug-05 19:30 
AnswerRe: Please help.. Pin
Stefan Troschuetz31-Aug-05 21:11
Stefan Troschuetz31-Aug-05 21:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.