I CREATE A WINDOWS FORM TO iNSERT AND SAVE DATA IN SQL SERVER THROUGH UER INPUT USING TOOLS
BUTTON 6 IS THE SAVE BUTTON
================================================================================
===========
CODE
Imports System.Data
Imports System.Data.SqlClient
Public Class account
Dim myconnection As SqlConnection
Dim mycommand As SqlCommand
Dim dr As SqlDataReader
Dim dr1 As SqlDataReader
dim ra as integer
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
myconnection = New SqlConnection("server=localhost;uid=sa;pwd=;database=medisam")
'you need to provide password for sql server
myconnection.Open()
mycommand = New SqlCommand("insert into account([ac],[actype],[msid],[ms]) values ('" & Label9.Text & "','" & ComboBox3.SelectedValue & "','" & ComboBox1.SelectedValue & "','" & ComboBox2.SelectedValue & "')", myconnection)
mycommand.ExecuteNonQuery()
'MessageBox.Show("New Row Inserted" & ra)
myconnection.Close()
End Sub
End Class