hey all please help me about my graduation project
i use this code to insert data on the table
and i have no error,but nothing will save
on the table..so please help me know why !!

thank on advance..

Imports System.Data.SqlClient
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim con As New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True;User Instance=True")
    Dim cmd As New SqlCommand()
    cmd.Connection = con
        MsgBox("Connection Open ! ")
        cmd.CommandText = "insert into admin (username,pass) values('rami','1234')"

        MsgBox("Record is successfully stored")

    Catch ex As Exception
        MsgBox("Can not open connection ! ")
    End Try

End Sub

End Class

Edited 3 Years Ago by abbOoOoOod: word mistake

hey sir try this one..

    INSERT INTO ADMIN VALUES(' " & texbox1.text &  " ' ,' " & textbox2.Text & " ' ) "

ADMIN = table name
textbox1 = textbox for username
textbox2 = textbox for password

and make sure if you create a table on sql server the table name is the same WHEN you are INSERT(Saving)

i did that,. and i have the same problem... data not saved on the table !!

The only problem that I can think of is if you misnamed your SQL database or if your database is saved in the wrong spot. I would look into it, it is the only problem that I can think of.

This article has been dead for over six months. Start a new discussion instead.