TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
azu donald
NA
1
0
need help iserting into mysql from vb.net
Oct 27 2009 11:52 AM
pls anytime i run this code i get a syntax error. i need someone to tell me what i'm doing wrong and point me in he right direction asap. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim command As New MySqlClient.MySqlCommand conn = New MySqlConnection conn.ConnectionString = "server=localhost;" _ & "database=cargomate;" _ & "userid=root;" _ & "password=admin" Try conn.Open() Catch myerror As MySqlException MsgBox("Error connecting to database") End Try cargo.transid = TextBox1.Text cargo.describe = TextBox2.Text cargo.num = TextBox3.Text cargo.weigh = TextBox4.Text cargo.ag = ComboBox1.SelectedItem cargo.air = ComboBox2.SelectedItem cargo.destiny = ComboBox3.SelectedItem Label9.Text = cargo.calprice Try sql = "insert into invoice(transactionid, description, quantity, weight, agent, airline, destination, price, timestamp) values =(' " & TextBox1.Text & " ', ' " & TextBox2.Text & " ', ' " & TextBox3.Text & " ', ' " & TextBox4.Text & " ', ' " & ComboBox1.SelectedItem & " ', ' " & ComboBox2.SelectedItem & " ', ' " & ComboBox3.SelectedItem & " ' ' " & Label9.Text & " 'now());" command.Connection = conn command.CommandText = sql command.ExecuteNonQuery() Catch myerror As MySqlException MsgBox("operation not sucessfull") End Try End Sub
Reply
Answers (
0
)
alternative solution for session
working with windows forms