変数が使えない。
関数を使ってダイレクトに入力
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cn As New MySql.Data.MySqlClient.MySqlConnection(My.Settings.SNConnectionString)
Dim cmd As MySql.Data.MySqlClient.MySqlCommand = cn.CreateCommand()
cmd.Connection = cn
cmd.CommandText = "insert into tbl_projectlog (logNO,ProjectCode,Schedule,Result,AddDate) VALUES ('" + DateTime.Now.ToString("HHmmss") + "','','','OK','" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "')"
cn.Open()
cmd.ExecuteNonQuery()
MessageBox.Show(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
cn.close()
End Sub
0 件のコメント:
コメントを投稿