Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,607 members, 7,812,998 topics. Date: Tuesday, 30 April 2024 at 02:43 AM

Vb.net Programmer Please come in and Help - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Vb.net Programmer Please come in and Help (1701 Views)

Experienced Asp.net Programmer Wanted For Immediate Employment / I Need To Learn Php And Vb.net / Cloudbridge LLC Needs A Java, C# C++, Visualbasic Or Vb.net Programmer Urgenlty (2) (3) (4)

(1) (Reply) (Go Down)

Vb.net Programmer Please come in and Help by OPEYEMIAD(m): 6:29pm On Dec 24, 2015
Am trying to Back up and restore my database, so have tried all my possible best
here is my code

FOR THE BACK UP
Imports MySql.Data.MySqlClient 'i import this statement before my public class formname

connectme() ' Have established a working connection with this already

dim strsql as string
strsql = "BACKUP DATABASE dbname TO DISK = C:\Users\LAPTOP\Desktop\dbname.sql"
Dim cmd As New MySqlCommand(strsql, con)
cmd.ExecuteNonQuery()

con.Close()

......................................Note: MySql.Data.dll is my reference
This is the error i got
An unhandled exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll

Additional information: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BACKUP DATABASE dbname TO DISK = C:\Users\LAPTOP\Desktop\dbname.sql' at line 1


FOR THE RESTORE
dim strsql as string
strsql = "RESTORE DATABASE dbname FROM DISK = C:\Users\LAPTOP\Desktop\dbname.sql"
Dim cmd As New MySqlCommand(strsql, con)
cmd.ExecuteNonQuery()

con.Close()
Your urgent intervention will be highly welcome and appreciated.
Re: Vb.net Programmer Please come in and Help by Nobody: 6:37pm On Dec 24, 2015
Re: Vb.net Programmer Please come in and Help by Nobody: 6:44pm On Dec 24, 2015
What version of vs do you use I use vs2015 .
Re: Vb.net Programmer Please come in and Help by OPEYEMIAD(m): 6:51pm On Dec 24, 2015
proxy20:
What version of vs do you use I use vs2015 .

i use 2013
Re: Vb.net Programmer Please come in and Help by Nobody: 6:54pm On Dec 24, 2015
Where can I get 2015 tutorials. 2015 is a bit different from 2013. video and pdf .
Re: Vb.net Programmer Please come in and Help by OPEYEMIAD(m): 7:00pm On Dec 24, 2015
proxy20:
download the code below and use the view
www.java2s.com/Open-Source/AspDotNet_Free_Code/Database/Download_MySqlBackup_NET_MySQL_Backup_Solution_for_C_VB_NET_ASP_NET.htm

thanks

Having checked the demo
I have problem with mysqlbackup.dll refrence at run time so its practically impossible for me to use..

it will be nice if my above code can be corrected
Re: Vb.net Programmer Please come in and Help by OPEYEMIAD(m): 9:49am On Dec 25, 2015
problem not yet solve am still waiting
Re: Vb.net Programmer Please come in and Help by OPEYEMIAD(m): 8:14pm On Dec 25, 2015
Hmm after several research i was able to solve the problem.

for learning purposes
i add mysql.data.dll and mysqlbackup. dll as reference then the code

[b]If txtBackupFile.Text = " " Then
MsgBox("No location selected", MsgBoxStyle.Critical, "Error Exporting Database"wink
btnBrowse.Focus()
Exit Sub
Else
connectme()
Dim cmd As MySqlCommand = New MySqlCommand
cmd.Connection = con
Dim mb As MySqlBackup = New MySqlBackup(cmd)
Try
If txtrestore.Text = "0" Then
mb.ExportToFile(txtBackupFile.Text)
MsgBox("Database Exported", MsgBoxStyle.Information, "Export Success"wink
ElseIf txtBackupFile.Text = "0" Then

mb.ImportFromFile(txtrestore.Text)

MsgBox("Database Imported", MsgBoxStyle.Information, "Import Success"wink
End If

con.Close()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error"wink
Exit Sub
End Try

End If[/b]


But i encounter another bigger problem

i store images into my database size of all the record amounting to 4MB after exporting am unable to import it due to the size

my questions:
1. what is the best way to store images into database ?
2. How do i import already exported database? i just upgrade my phpmyadmin so i cant continue without importing my database
please help
Re: Vb.net Programmer Please come in and Help by OPEYEMIAD(m): 8:30am On Dec 26, 2015
OPEYEMIAD:
Hmm after several research i was able to solve the problem.

for learning purposes
i add mysql.data.dll and mysqlbackup. dll as reference then the code

[b]If txtBackupFile.Text = " " Then
MsgBox("No location selected", MsgBoxStyle.Critical, "Error Exporting Database"wink
btnBrowse.Focus()
Exit Sub
Else
connectme()
Dim cmd As MySqlCommand = New MySqlCommand
cmd.Connection = con
Dim mb As MySqlBackup = New MySqlBackup(cmd)
Try
If txtrestore.Text = "0" Then
mb.ExportToFile(txtBackupFile.Text)
MsgBox("Database Exported", MsgBoxStyle.Information, "Export Success"wink
ElseIf txtBackupFile.Text = "0" Then

mb.ImportFromFile(txtrestore.Text)

MsgBox("Database Imported", MsgBoxStyle.Information, "Import Success"wink
End If

con.Close()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error"wink
Exit Sub
End Try

End If[/b]


But i encounter another bigger problem

i store images into my database size of all the record amounting to 4MB after exporting am unable to import it due to the size

i was able to solve my problem
my questions:
1. what is the best way to store images into database ?

i created a folder named passport inside my disk and send all the pictures in to the folder while saving directory into the database. it work fine

2. How do i import already exported database? i just upgrade my phpmyadmin so i cant continue without importing my database
please help

i edit my php.ini inside my phpmyadmin theremy enable me to upload upto 900M file size but still showing error during importation then
I open the sql file using notepad and delete all the converted binary file.
then i copied only the sql command and run it inside phpmyadmin

everything work fine


forgive me for asking question and answering my self
Re: Vb.net Programmer Please come in and Help by demolinton4comi: 11:38pm On Dec 29, 2015
If this might help is not very good to store but pics and videoin inside database ur programma be slow try and store it inside a folder then u store the location and name inside ur db

(1) (Reply)

! / Reward Yourself With A Storyline For A Game / I Need A Topic On Computer Science Projet That Deals With Java Programming

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 20
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.