Zum Inhalt springen

igurov

Mitglieder
  • Gesamte Inhalte

    25
  • Benutzer seit

  • Letzter Besuch

Beiträge von igurov

  1. Hallo Leute,

    ich habe eine konkrete Frage bezüglich MFC mit Worker Thread. Also, ich habe einen Button „Go“, der viele Dingen macht, und ich möchte in ihm einen Thread aufrufen, der die Function getCurrentPosition braucht. Ich habe auch ein Static Text wo das Ergebnis dieser Function etwa alle 0.5s. angezeigt wird.

    Daher brauche ich eine globale Function threadFunction.

    
    UINT threadFunction (LPVOID lparam)
    
    {
    
    	Myclass* myobj = (Myclass *) lparam;
    
    	CString status;
    
    	if(myobj == NULL)
    
    		return 1;
    
    	else
    
    {
    
    	for (int i = 0; i < 10; i++)
    
    	{
    
    	 status = getCurrentPosition();
    
             myobj->posVar.SetDlgItemTextW (staticText,static_cast<LPCTSTR>(status));
    
            // posVar is control variable to the staticText
    
             }
    
    
    }
    
    
    	return 0;
    
    }
    
    
    
    Jetzt möchte ich diese Funktion von dem Button „Go“ aufrufen
    
    void Myclass::OnBnClickedGo()
    
    {
    
    	Myclass* newObj = new Myclass;
    
    	CWinThread *pThread = AfxBeginThread
    
    		(threadFunction,newObj);
    
    }
    
    

    So weit so gut, aber wenn ich den Button „Go“ klicke, erscheint der unten stehenden Debug Fehler:

    Debug Assertion Fehler

    Line 154

    Winocc.cpp

    Und das ist passiert wenn das Porgram diese Linie probiert zu ausführen –

    myobj->posVar.SetDlgItemTextW (staticText,static_cast<LPCTSTR>(status));

    Ich habe viel versucht, aber bis jetzt hat noch nichts geklappt.

    Hoffentlich hat jemand Idee wie ich das Problem lösen kann. :)

  2. Hallo Leute,

    Ich habe eine MFC Anwendung mit zwei Buttons, die die zwei nachstehenden getrennten Funktionen aufruft.

    
    void CUSBtoCANDlg::OnBnClickedHomeButton1()
    
    {
    
    	int pos=movePos(ini, float(movePos) );
    
    }
    
    
    
    void CUSBtoCANDlg::OnBnClickedHomeButton2()
    
    {
    
    	int pos2=moveSecondRamp(ini, float(movePos) );
    
    }
    
    
    

    Das Problem ist, wenn ich auf den ersten Button drücke, muss ich warten bis die movePos Funktion beendet ist. Erst dann kann ich den zweiten Botton drücken. Ich möchte nämlich die zwei Funktionen nacheinander aufrufen können ohne warten zu müssen bis die erste fertig ist!

    Haben Sie Ideen wie ich es machen kann? :)

    Danke,

    Iliya

  3. Hi,

    Leider geht es nicht bei mir.

    Es gibt zwei Fehler wenn ich den Projekt erstelle:

    extern CComboBox* asdComboModules;

    CString str;

    for (int i=0;i < 10;i++)

    {

    str.Format(_T("item string %d"), i);

    asdComboModules->AddString( str );

    }

    error LNK2001: unresolved external symbol "class CComboBox * asdComboModules" (?asdComboModules@@3PAVCComboBox@@A)

    fatal error LNK1120: 1 unresolved externals

    Die Name meiner ComboBox is IDC_COMBO9.

    Wie kann ich vorgeben dass der Code mit genau IDC_COMBO9(nicht mit IDC_COMBO8) zu tun hat.

    Danke.

    Iliya

  4. Hallo,

    Ich habe keine Erfahrung mit MFC (VS 2005) und deswegen habe ich sehr einfache Fragen.

    Ich möchte eine Anwendung mit Edit Control, Button and Static Text erstellen - Wenn man einen Text im Edit Control eingeben und dann auf den Knopf drücken, muss diesen Text in dem Static Text angezeigt werden.

    
    void CCANDlg::OnEnChangeEdit1()
    
    {
    
    
      string input   = (string )cell_var. GetString();
    
    
    
    }
    
    
    void CCANDlg::OnBnClickedButton1()
    
    {
    
    	// TODO: Add your control notification handler code here
    
    
    }
    
    

    Vielleicht können Sie mir helfen das zu machen.

    Danke,

    Iliya

    PS.

    Gibt es ein gutes Tutorial für MFC mit VS2005?

  5. Es gibt ein Problem mit

    
    "RECIPEID" LIKE :RECIPEID%
    
    

    wahrscheinlich wegen %.:rolleyes:

    Unbehandelte Ausnahme beim Ausführen der aktuellen Webanforderung. Überprüfen Sie die Stapelüberwachung, um weitere Informationen über diesen Fehler anzuzeigen und festzustellen, wo der Fehler im Code verursacht wurde.

  6. Nein. :)

    Als ich hab geschrieben, brauche ich all recipeID die die gesuchte Reihung enthalten.

    Beispiel:

    Table:recipeId

    Column recipeID:

    cool

    cool2

    cool3

    Jetzt wenn ich ein Select mit RecipeId="cool" ausführe, ist das Ergebnis nur "cool". Das problem ist dass ich cool, cool2 and cool3 brauchen möchte, weil alle die Reihung "cool" enthalten.

    Gruß,

    Iliya

  7. Hallo,

    Ich hab eine einfache Implementation der Suche in Oracle Databank wie nachstehend:

    
    SelectCommand='SELECT * FROM "RECIPE_ID" WHERE ("RECIPEID" = :RECIPEID) ORDER BY "TOOL_ID"'
    
    

    zum Beispiel:

    1.Suchen nach recipeID: coolId

    Suche Ergebnis: coolId

    Aber brauche ich alle RecipeId als Ergebnis die die gesuchte Reihung enthalten.

    zum Beispiel:

    1.Suchen nach recipeID: coolId

    Suche Ergebnis: coolId, coolid2,coolid_late etc.

    Wie kann ich den Select Befehl verbessern?

    Danke,

    Iliya

  8. Ich brauche die letzten 5 Daten jeden Tag als Parameter verwenden.

    Wenn ich deine Lösung realisiren, muss ich das Skript jeden Tag verändern.

    Daswegen brauche ich ein externes Anwendung:

    
    if (args[0] == "current")
    
                {
    
                    DateTime dt = DateTime.Now;
    
                    string tostring = dt.ToString("yyyyMMdd");
    
                    Console.WriteLine("{0}", tostring);
    
                    number = int.Parse(tostring);
    
    
                }
    
                if (args[0] == "previous")
    
                {
    
                    DateTime dt = DateTime.Now.AddDays(-1); ;
    
                    string tostring = dt.ToString("yyyyMMdd");
    
                    Console.WriteLine("{0}", tostring);
    
                    number = int.Parse(tostring);
    
    
                }
    
    ......
    
    
    und dann:
    
    em Ausführung das date_string.exe Programm und spreichern das Ergebnis in einem temporalen  temp.txt File
    
    C:\temp\date_string.exe "current" > temp.txt
    
    
    rem festelegen die variable datum
    
    set /p datum= < temp.txt
    
    echo Backup Folder Dates to be exported...
    
    echo  %datum%
    
    
    rem entfernen das temp.txt File
    
    del temp.txt
    
    
    C:\temp\date_string.exe "previous" > temp.txt
    
    set /p datum1= < temp.txt
    
    echo %datum1%
    
    del temp.txt
    
    ....
    
    

    Meinst du nicht auch?

    Gruß,

    Iliya

  9. Hallo,

    Ich habe ein kleines Programm für Konvertit das aktualle Datum in einer Reihung.

    
    static int Main(string[] args)
    
    {
    
    DateTime dt = DateTime.Now;
    
    string tostring = dt.ToString("yyyyMMdd");
    
    Console.WriteLine("{0}", tostring);
    
    return int.Parse(tostring);
    
    } 
    
    
    Jetzt möchte ich dieses Ergebnis als eine Datumvariable in .cmd Scrpit nutzen.
    
    @ECHO OFF
    
    copy "C:\Program Files\Microsoft Visual Studio 8\VC#\CSharpProjects\date_string\date_string\bin\Release\date_string.exe" c:\temp
    
    set variable=c:\temp\date_string.exe
    
    set AGCLOG="C:\RCP VIEWER PARSER\report.txt"
    
    echo Setting the variable...
    
    echo --- start -------- >> %AGCLOG%
    
    echo %variable% >> %AGCLOG%
    
    pause
    
    
    Wenn ich das report.txt öffnen, ist das Ergebnis den entstehenden Text: --- start --------------------------------------------------------------------- c:\temp\date_string.exe Das Problem ist dass die Varialbe die Resultat von dem Programm nehmen muss. Mit diesem code
    set variable=c:\temp\date_string.exe
    
    

    ist aber leider die Variable = c:\temp\date_string.exe stattdessen = 20080806

    Gruß Iliya

  10. Hallo,

    Bitte entchuldigen Sie mein schlechtes Deutsch.

    Ich hab ein C# Projekt für die Ablesung einer .csv Files. Wenn Ich das Projekt mit Visual Studio ausführe, ist alles in Ordnung. Aber habe ich Probleme bei der Ausführung des Projecktes mit einem .cmd script. Das Projekt hat eine Funktion "readInput" die in der Klasse "Parser" ist.

    Wenn Ich den Script mit dem untenstehenden Code ausführe, die Funktion nicht ausgeführt wird. Die .txt File enthält den Pfad zu den cvs Ordner.

    copy C:\Parser\Parser\bin\Release\Parser.exe C:\temp

    c:\temp\Parser Parser readInput C:\Parser\Parser\bin\Release\input.txt

    del c:\temp\RecipeParser.exe

    pause

    Danke für die Hilfe.

    Guru

  11. Erm, yeah, but you shoud tell them, where your table is.

    It will never work if you use the path of the mdb as datasource at every time.

    Well, I am not sure you got my previous point.

    1 case) -working

    c:\temp\TelRecConvertor IniImporter #E:\[..]\inidir.txt

    MdbExporter E:\arbeit\db.mdb

    2 case) -workig

    c:\temp\TelRecConvertor IniImporter #E:\[..]\inidir.txt

    MdbExporter E:\arbeit\whatever.mdb

    The thing is that you have to have an mdb database that already exists in this place when u write the dataset in this database.

    But what about when I want to write in Oracle ...? :(

  12. Hi.

    Is the structure of the csv always identical? Then write a SQL Script to create the DataTable in the OracleDB and use the OracleDataAdapter for filling afterwards.

    .

    Actually there are around 10 different formats thats why I am using my own parser.

    I mean this line

    
    string conStr = "Provider=Microsoft.Jet.OLEDB.4.0;" +
    
    "Data Source=" + names[0] + ";";
    
    

    So the argument shouldn't be G:\... and so on, but the URI-Path to your Oracle-Server

    Doesn' work. I changed my connection string and cmd file as well. Here is it: execute.cmd file -

    MdbExporter ORA102.DRS.QIM.COM .It raised an exception -

    Error: Unable to open database: ORA102.DRS.QIM.COM

    Exception Information:

    Could not find file 'E:\arbeit\Parser\TelRecConvertor\TelRecConvertor\bin\Releas

    e\ORA102.DRS.QIM.COM'.

  13. I didn't get your first point- what do you mean by "do you set the first application argument (G:\[...]\temp .mdb) to the oracle path" ?

    And also I don't know how to test it with the oracle database since the database is at remote server and I have only access to it(of course I can create tables and stuff like this), but I don't have the database in my local disk.

    How can I test it then (G:\[...]\????) :mod:

    Any ideas?

  14. Thanks for the help btw :)

    1.- Does really every columntype is a varchar?

    Well, yes. Despite this, in some columns I am storing only numbers (only used for a name of a tool).

    2. What does TryExecute do? Only send the Querry or does it send a commit too?

    Both of them. I am using it to execute the statement and populate the .mdb file. The code works fine. The mdb contains correctly all needed tables.

  15. Well, I did the same thing but exporting the dataset to microsoft access file(see code below). But now for the Oracle it is a little bit more complicated for me since I don't have experience with it:

    public void Write(DataSet ds, string[] names)

    {

    string conStr = "Provider=Microsoft.Jet.OLEDB.4.0;" +

    "Data Source=" + names[0] + ";";

    Console.WriteLine("Exporting to database {0} ...", names[0]);

    DbConnection connection = new OleDbConnection(conStr);

    try

    {

    connection.Open();

    }

    catch (DbException e)

    {

    ConsoleEx.WriteException(true, e, "Unable to open database: {0}", names[0]);

    throw;

    }

    DbCommand command = connection.CreateCommand();

    foreach (DataTable table in ds.Tables)

    {

    Console.WriteLine("\tDeleting table: {0}", table.TableName);

    // delete old tables

    command.CommandText = string.Format("drop table {0}", table.TableName);

    TryExecute(command, false);

    // create new

    Console.WriteLine("\tCreating new table: {0}", table.TableName);

    string[] columnStrings = new string[table.Columns.Count];

    for (int i = 0; i < table.Columns.Count; i++)

    columnStrings = "`" + table.Columns.ColumnName + "`" + " varchar";

    command.CommandText = string.Format("create table {0} ({1})",

    table.TableName, string.Join(", \n", columnStrings));

    TryExecute(command, true);

    // add rows

    for (int row = 0; row < table.Rows.Count; row++)

    {

    for (int col = 0; col < table.Columns.Count; col++)

    columnStrings[col] = "'" + Convert.ToString(table.Rows[row].ItemArray[col]) + "'";

    command.CommandText = string.Format("insert into {0} values ({1})",

    table.TableName, string.Join(", \n", columnStrings));

    TryExecute(command, true);

    }

    }

    connection.Close();

    So could you please help with writing the same thing but for Oracle database.

  16. Hello,

    Sorry for writing in English but my German is still not good enough :).So my question -

    I am reading a dataset from .csv files and now I want to write this dataset to an oracle database. I want to create these datatables in the database and every time after that the tables should be only updated. I started with openning the oracle connection but I am not sure how to proceed further. Any ideas?

    Thanks

    Code:

    public void Write(DataSet ds, string[] names)

    {

    string conStr = "User d=***;Password=***;DataSource=***";

    Console.WriteLine("Exporting to dataset {0} ...", names[0]);

    OracleConnection oraConnection = new OracleConnection(conStr);

    try

    {

    oraConnection.Open();

    Console.WriteLine("\nHello, Oracle Here!\n");

    Console.WriteLine("Connection String: ");

    Console.WriteLine(oraConnection.ConnectionString.ToString() + "\n");

    Console.WriteLine("Current Connection State: ");

    Console.WriteLine(oraConnection.State.ToString() + "\n");

    Console.WriteLine("Oracle Database Server Version: ");

    Console.WriteLine(oraConnection.ServerVersion.ToString());

    }

    catch (Exception ex)

    {

    Console.WriteLine("Error occured: " + ex.Message);

    }

    // create the command object

    OracleCommand command = new OracleCommand(conStr);

    foreach (DataTable table in ds.Tables)

    {

    .........

    .........

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...