954,174 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Any expert can solve this???

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

BlurStar
Newbie Poster
5 posts since Aug 2005
Reputation Points: 10
Solved Threads: 0
 

what's the error message?

campkev
Posting Pro in Training
484 posts since Jul 2005
Reputation Points: 14
Solved Threads: 19
 

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

Additional information: System error.

BlurStar
Newbie Poster
5 posts since Aug 2005
Reputation Points: 10
Solved Threads: 0
 

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.

plazmo
Posting Whiz in Training
207 posts since Aug 2005
Reputation Points: 23
Solved Threads: 16
 
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 :!:

BlurStar
Newbie Poster
5 posts since Aug 2005
Reputation Points: 10
Solved Threads: 0
 
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:

lol_m
Newbie Poster
1 post since Mar 2007
Reputation Points: 10
Solved Threads: 0
 

how mucg ram do you have btw?

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

jbennet
Moderator
Moderator
18,523 posts since Apr 2005
Reputation Points: 1,820
Solved Threads: 600
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You