Imports System.Data.SqlClient
Public Class Form6
Dim cmd As New SqlCommand
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
cmd.Connection = Class1.strcon
cmd.CommandText = "insert into dt values('" & (TextBox1.Text) & "')"
cmd.ExecuteNonQuery()
MessageBox.Show("inserted")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Form6_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Text = System.DateTime.Now.ToString((" yyyy-MM-dd"))
End Sub
End Class