Any expert can solve this??

Error message will occur during execution, is something related to sql. the program will show an error on objcommand.executeNonQuery. Can solve this?

Imports System
Imports System.Data
Imports System.Data.SqlClient

Public Class Form1
Inherits System.Windows.Forms.Form
Dim objConnection As SqlConnection = New _
SqlConnection("server=(local);database=uni;" & _
"Integrated Security=True")
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim objCommand As SqlCommand = New SqlCommand
objCommand.Connection = objConnection

objCommand.CommandText = "INSERT INTO login" & _
"(user,Password)" & _
"VALUES('steven','123456')"
objConnection.Open()
objCommand.ExecuteNonQuery()
objConnection.Close()
End Sub
End Class

the error message is:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll

Additional information: System error.

the error message is:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll

Additional information: System error.

check your table restraints, like the username might be need to be unique so it cant add the a duplicated key., i had this error and i think that was the problem.
if that is not what is wrong ill try to remeber if it was soemthig else, but im perdy sure its because the database wont let you add it for a reason like duplication.

check your table restraints, like the username might be need to be unique so it cant add the a duplicated key., i had this error and i think that was the problem.
if that is not what is wrong ill try to remeber if it was soemthig else, but im perdy sure its because the database wont let you add it for a reason like duplication.

Thank you... you are the only one that help me in this problems.. thanks * 100 :!:

check your table restraints, like the username might be need to be unique so it cant add the a duplicated key., i had this error and i think that was the problem.
if that is not what is wrong ill try to remeber if it was soemthig else, but im perdy sure its because the database wont let you add it for a reason like duplication.

-------
hey i don'no how to thankful of you , you are my loveeeeeeeeeeeeeeeeeeee
thank really , i challenge with this damn error all over of 2 days
really thx
:cheesy:

how mucg ram do you have btw?

on less than 256 (512 is better) SQL doesnt play nicely and often gives wierd error messages

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