Click here to Skip to main content
15,890,557 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Check box Error Message Pin
Bob Beaubien22-Aug-09 3:28
Bob Beaubien22-Aug-09 3:28 
GeneralRe: Check box Error Message Pin
Bob Beaubien22-Aug-09 6:04
Bob Beaubien22-Aug-09 6:04 
Questionrelative positioning of objects on forms Pin
tolmega0121-Aug-09 11:42
tolmega0121-Aug-09 11:42 
AnswerRe: relative positioning of objects on forms Pin
Henry Minute21-Aug-09 12:41
Henry Minute21-Aug-09 12:41 
AnswerRe: relative positioning of objects on forms Pin
Mycroft Holmes21-Aug-09 17:27
professionalMycroft Holmes21-Aug-09 17:27 
Questionhow can I load a word document into a form? Pin
waner michaud21-Aug-09 7:37
waner michaud21-Aug-09 7:37 
AnswerRe: how can I load a word document into a form? Pin
Mycroft Holmes21-Aug-09 17:31
professionalMycroft Holmes21-Aug-09 17:31 
QuestionRestoring mySQL database via VB net application problem Pin
558 jakobsson21-Aug-09 5:54
558 jakobsson21-Aug-09 5:54 
Using VB 2008 Express and MySQL 5.1.36 community server I created a database application whose idea is to keep some data about digital pictures (place taken, description, filepaths for the picture and so on). Works well to suite my needs. Through the app I can also create backupfiles using mysqldump. It is a standalone app. supposed to be used locally. MySQL uses MyIsam not InnoDb.

Via the mysql commandline it is possible to restore the database using the backupfile like this:
"mysql> source C:/dump.sql;" and that also works for a more complex path with more slashes in. It does not work with underscores in the path (or I did not bother to find a solution, I changed the actual paths instead to avoid that problem.)

Via the command line it also works like this:
"mysql> source C:\dump.sql;" however the beep sounds but the restoration takes place. So best use is the forward slashes /// in the first example to avoid the beeping.

The dump file is written to Create Database if not exists and the corresponding drop tables if exists is there. As I said, the dump file works to restore by the commandline.

Through VB then? Not a chance so far. I have read TFM but it doesn't have much to say. Google has been used but without success so far.

Friend Sub RestoreIt()<br />
        Dim ArgumentString As String, UserString As String, PasswordString As String <br />
        Dim str4Q As String = """"<br />
        Dim p1 As New ProcessStartInfo, FilePath As String = App_Path()<br />
        FilePath = Replace(FilePath, "\", "/")<br />
        Dim DumpFile As String = FilePath & "dump.sql"<br />
        UserString = "root"<br />
        PasswordString = "blabla"<br />
        ArgumentString = " --user=" & UserString & " --password=" & PasswordString & " source " & DumpFile<br />
        <br />
        Try<br />
            With p1<br />
                .UseShellExecute = False<br />
                .FileName = "C:\Program\MySQL\MySQL Server 5.1\bin\mysql.exe"<br />
                .Arguments = ArgumentString<br />
            End With<br />
            Process.Start(p1)<br />
<br />
        Catch ex As Exception<br />
            MessageBox.Show(ex.Message, _<br />
                                   Me.Text, _<br />
                                   MessageBoxButtons.OK, _<br />
                                   MessageBoxIcon.Error)<br />
        End Try<br />
<br />
    End Sub<br />
Public Function App_Path() As String<br />
        Return System.AppDomain.CurrentDomain.BaseDirectory()<br />
    End Function<br />


The process starts but nothing happens. I dont know how to go on. Is it possible to read the process line by line and see where the errors occcurs? It rolls on like an thunderstorm with some lines. Or does someone have an direct answer to solve my problem? Where the dumpfile is located could not be the problem cause it works from the commandline from different locations such as C:/dump and C:/Whatever/Dump/Anotherdump/dump.sql

I tried with and without the """" (as in str4Q) before and after the filevariable but nothing works. Those four quotes is necessary when creating the dumpfile via mysqldump. I have also tried to write a batch file to run instead of the System.Process but no result.

As could be seen in the code I have replaced the back slashes with forward slashes. Tried the opposite and also with double slashes but no result.
Any hints are more than welcome,
leif, sweden
AnswerRe: Restoring mySQL database via VB net application problem/SOLVED Pin
558 jakobsson22-Aug-09 2:09
558 jakobsson22-Aug-09 2:09 
QuestionHow to Get the Source Path Pin
Anubhava Dimri21-Aug-09 2:01
Anubhava Dimri21-Aug-09 2:01 
AnswerRe: How to Get the Source Path Pin
DidiKunz21-Aug-09 2:19
DidiKunz21-Aug-09 2:19 
GeneralRe: How to Get the Source Path Pin
Anubhava Dimri21-Aug-09 18:13
Anubhava Dimri21-Aug-09 18:13 
AnswerRe: How to Get the Source Path Pin
Tom Deketelaere21-Aug-09 3:26
professionalTom Deketelaere21-Aug-09 3:26 
GeneralRe: How to Get the Source Path Pin
Anubhava Dimri23-Aug-09 19:37
Anubhava Dimri23-Aug-09 19:37 
GeneralRe: How to Get the Source Path Pin
Tom Deketelaere23-Aug-09 20:46
professionalTom Deketelaere23-Aug-09 20:46 
GeneralRe: How to Get the Source Path Pin
Dave Kreskowiak24-Aug-09 3:28
mveDave Kreskowiak24-Aug-09 3:28 
QuestionRun Application when Computer Start Up Pin
Ahmad Rifai Yusuf20-Aug-09 20:31
Ahmad Rifai Yusuf20-Aug-09 20:31 
AnswerRe: Run Application when Computer Start Up Pin
darkelv20-Aug-09 20:46
darkelv20-Aug-09 20:46 
AnswerRe: Run Application when Computer Start Up Pin
Hristo-Bojilov20-Aug-09 23:25
Hristo-Bojilov20-Aug-09 23:25 
Questionimport contact from yahoo, gmail etc Pin
Rupesh Kumar Swami20-Aug-09 19:08
Rupesh Kumar Swami20-Aug-09 19:08 
AnswerRe: import contact from yahoo, gmail etc Pin
dan!sh 20-Aug-09 19:44
professional dan!sh 20-Aug-09 19:44 
QuestionDestop Recorder Pin
Anubhava Dimri20-Aug-09 18:51
Anubhava Dimri20-Aug-09 18:51 
AnswerRe: Destop Recorder [modified] Pin
Hristo-Bojilov20-Aug-09 23:19
Hristo-Bojilov20-Aug-09 23:19 
GeneralRe: Destop Recorder Pin
Anubhava Dimri21-Aug-09 2:03
Anubhava Dimri21-Aug-09 2:03 
GeneralRe: Destop Recorder [modified] Pin
Hristo-Bojilov21-Aug-09 2:11
Hristo-Bojilov21-Aug-09 2: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.