Autor Beitrag
CarpeDiem
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 128

WIN XP
Borland C++ 2002, CodeGear C++ 2007, C# (VS 2008)
BeitragVerfasst: Do 12.06.08 17:48 
Hallo,
bisher habe ich mit Borland C++ programmiert und da über die BDE auf Paradox-Datenbanken zugegriffen. Ich möchte jetzt auf C# umsteigen und wollte meine schon gefütterten Paradox-Datenbanken weiterhin nutzen. Ist dies möglich? Wenn ja, vielleicht könnte mir jemand einen Tipp geben, wie? :?:
Vielen Dank.

_________________
Stefan - Carpe Diem
Es ist keine Schande zu fallen, eine Schande ist nur nicht wieder aufzustehen
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Do 12.06.08 18:00 
Laut dem hier geht das über eine ODBCDbConnection (was ein Buchstabenhaufen :lol:).

Ab da sollte Dir dieses Kapitel zum Datenbank-Zugriff helfen.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
JüTho
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2021
Erhaltene Danke: 6

Win XP Prof
C# 2.0 (#D für NET 2.0, dazu Firebird); früher Delphi 5 und Delphi 2005 Pro
BeitragVerfasst: Do 12.06.08 18:17 
Auch unter ConnectionStrings findet man weitere Hinweise. Danach geht es auch mit OleDbConnection; das ist besser als Odbc.

Jürgen
CarpeDiem Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 128

WIN XP
Borland C++ 2002, CodeGear C++ 2007, C# (VS 2008)
BeitragVerfasst: Do 12.06.08 18:18 
Ok, danke. Das ist genau das richtige.

_________________
Stefan - Carpe Diem
Es ist keine Schande zu fallen, eine Schande ist nur nicht wieder aufzustehen
CarpeDiem Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 128

WIN XP
Borland C++ 2002, CodeGear C++ 2007, C# (VS 2008)
BeitragVerfasst: Mi 25.06.08 10:44 
Hallo, habe jetzt mal Zeit gehabt, das ganze auszuprobieren. Leider bekomme ich jetzt immer eine Fehlermeldung:
Zitat:
Fehler Zugriff auf Paradox-Datenbank:
========================

System.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben
bei System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
bei System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
bei System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
bei System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
bei System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
bei System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
bei System.Data.Odbc.OdbcConnection.Open()
bei EasyQuick.Form1.Btn_ParadoxDBAuslesen_Click(Object sender, EventArgs e) in E:\Projekte\TigraDE\IT_EDV\EasyQuick\VISU\AV\EasyQuick\EasyQuick\EQ_Startseite.cs:Zeile 148.

ausblenden volle Höhe C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
.
.
using System.Data.Odbc;
.
.
private void Btn_ParadoxDBAuslesen_Click(object sender, EventArgs e)
{
// Verbindung anlegen
OdbcConnection PConnection = new OdbcConnection("Microsoft Paradox Driver (*.db )};DriverID=538;Fil=Paradox 5.X;" + 
                                                "DSN=MESSKRIT;DefaultDir=C:\\_FERTIG" +
                                                "DBQ=C:\\_FERTIG");
try
    {

    String strSelection = "INSERT INTO MESSKRIT(Name) " + "VALUES('Test')";

    PConnection.Open(); //Zeile 148

    OdbcCommand PCommand = new OdbcCommand(strSelection, PConnection);
    PCommand.ExecuteNonQuery();

    }
catch (System.Exception ex)
    {
    // Verbindung schliessen
    PConnection.Close();

    // Fehlermeldung
    String strMsgBox = "Fehler Zugriff auf Paradox-Datenbank:\n";
    strMsgBox = strMsgBox + "========================\n\n";
    strMsgBox = strMsgBox + ex.ToString();
    MessageBox.Show(strMsgBox);
    }
// Verbindung schliessen
PConnection.Close();
}

Kann mir jemand sagen, was ich falsch mache? Ich will nur einen Datensatz einfügen.
Vielen Dank.

_________________
Stefan - Carpe Diem
Es ist keine Schande zu fallen, eine Schande ist nur nicht wieder aufzustehen
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 25.06.08 10:52 
Bei Deinem ConnectionString fehlt am Anfang ein "{".

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
CarpeDiem Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 128

WIN XP
Borland C++ 2002, CodeGear C++ 2007, C# (VS 2008)
BeitragVerfasst: Mi 25.06.08 11:00 
Danke, habe ich jetzt eingefügt, leider bekomme ich immer noch die gleiche Fehlermeldung.

_________________
Stefan - Carpe Diem
Es ist keine Schande zu fallen, eine Schande ist nur nicht wieder aufzustehen
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 25.06.08 11:07 
Hier wird bei Verzeichnissen immer noch ein abschließendener "\" gemacht, liegt's vielleicht daran?

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
CarpeDiem Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 128

WIN XP
Borland C++ 2002, CodeGear C++ 2007, C# (VS 2008)
BeitragVerfasst: Mi 25.06.08 11:54 
Habe ich auch schon probiert, funktioniert leider auch nicht.

_________________
Stefan - Carpe Diem
Es ist keine Schande zu fallen, eine Schande ist nur nicht wieder aufzustehen
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Mi 25.06.08 12:23 
Kann es sein, dass zwischen den Parametern DefaultDir und DBQ noch ein Semikolon fehlt?
CarpeDiem Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 128

WIN XP
Borland C++ 2002, CodeGear C++ 2007, C# (VS 2008)
BeitragVerfasst: Mi 25.06.08 12:42 
Ja, das hat gefehlt. Aber leider wars das auch nicht. Habe immer noch die gleiche Fehlermeldung. Mittlerweile habe ich mich schon "ausgegoogelt".

_________________
Stefan - Carpe Diem
Es ist keine Schande zu fallen, eine Schande ist nur nicht wieder aufzustehen
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 25.06.08 12:48 
Hast Du mal mit OleDB anstatt ODBC versucht?
noch zwei Ideen: Ist der Treiber installiert? Hast Du die Benutzerrechte, um auf die Datenbank zuzugreifen?

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Mi 25.06.08 12:48 
Aber das DRIVER= fehlt bei Dir immer noch am Anfang, hast Du das drin?
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 25.06.08 12:49 
:lol: Das hab ich auch übersehen

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
CarpeDiem Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 128

WIN XP
Borland C++ 2002, CodeGear C++ 2007, C# (VS 2008)
BeitragVerfasst: Mi 25.06.08 12:50 
Danke, das habe ich gerade auch herausgefunden. Vielen Dank für Eure Hilfe.

_________________
Stefan - Carpe Diem
Es ist keine Schande zu fallen, eine Schande ist nur nicht wieder aufzustehen
CarpeDiem Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 128

WIN XP
Borland C++ 2002, CodeGear C++ 2007, C# (VS 2008)
BeitragVerfasst: Mi 25.06.08 13:10 
Noch eine Frage user profile iconChristian S.. Gehört hier nicht rein, aber hast Du meine E-Mail über die Benutzernamen-Änderung bekommen? Habe noch keine Antwort von Dir bekommen.

_________________
Stefan - Carpe Diem
Es ist keine Schande zu fallen, eine Schande ist nur nicht wieder aufzustehen