944,092 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 4767
  • VB.NET RSS
Feb 17th, 2006
0

Any expert can solve this???

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
BlurStar is offline Offline
5 posts
since Aug 2005
Feb 17th, 2006
0

Re: Any expert can solve this???

what's the error message?
Reputation Points: 14
Solved Threads: 19
Posting Pro in Training
campkev is offline Offline
484 posts
since Jul 2005
Feb 17th, 2006
0

Re: Any expert can solve this???

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

Additional information: System error.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
BlurStar is offline Offline
5 posts
since Aug 2005
Feb 18th, 2006
0

Re: Any expert can solve this???

Quote originally posted by BlurStar ...
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.
Reputation Points: 23
Solved Threads: 16
Posting Whiz in Training
plazmo is offline Offline
206 posts
since Aug 2005
Feb 20th, 2006
0

Re: Any expert can solve this???

Quote originally posted by plazmo ...
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 :!:
Reputation Points: 10
Solved Threads: 0
Newbie Poster
BlurStar is offline Offline
5 posts
since Aug 2005
Mar 30th, 2007
0

Re: Any expert can solve this???

Click to Expand / Collapse  Quote originally posted by plazmo ...
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:
Reputation Points: 10
Solved Threads: 0
Newbie Poster
lol_m is offline Offline
1 posts
since Mar 2007
Mar 30th, 2007
0

Re: Any expert can solve this???

how mucg ram do you have btw?

on less than 256 (512 is better) SQL doesnt play nicely and often gives wierd error messages
Moderator
Featured Poster
Reputation Points: 1800
Solved Threads: 575
Moderator
jbennet is offline Offline
16,534 posts
since Apr 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Dynamically changing a form at Run Time
Next Thread in VB.NET Forum Timeline: Why wouldn't it work to....





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC