| | |
Any expert can solve this???
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2005
Posts: 5
Reputation:
Solved Threads: 0
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
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
•
•
•
•
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.
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.
•
•
Join Date: Aug 2005
Posts: 5
Reputation:
Solved Threads: 0
•
•
•
•
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.
•
•
Join Date: Mar 2007
Posts: 1
Reputation:
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:
![]() |
Similar Threads
- Again here for help (VB.NET)
- need help (VB.NET)
- tomcat jsp problem (JSP)
- IE 6 all pages white background, font sizes erratic (Web Browsers)
- C++ is dying a slow death (C++)
- Seeking DW MX 2004 Expert (Site Layout and Usability)
- Need Help for DNS Problem and 'about:blank' Problem ... (Viruses, Spyware and other Nasties)
- please help been at my pc for hours still cannot solve problem (Viruses, Spyware and other Nasties)
Other Threads in the VB.NET Forum
- Previous Thread: Dynamically changing a form at Run Time
- Next Thread: Why wouldn't it work to....
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2005 2008 access account application array arrays basic beginner browser button buttons center checkbox client code convert cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic eclipse excel fade filter forms ftp generatetags gridview html images inline input insert intel internet listview mobile monitor net objects open panel passingparameters pdf picturebox port position print printing problem read remove save searchvb.net select serial settings shutdown soap sorting sqlserver survey table tcp temperature textbox timer timespan transparency trim update user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web webbrowser winforms wpf wrapingcode year






