| | |
SQL DataSet Exception
Thread Solved |
•
•
Join Date: Jul 2008
Posts: 45
Reputation:
Solved Threads: 1
I am helping a friend with a project in Visual Basic, it is a program that uses a SQL database. There are some rows in the database, we can review them just fine. So the SELECT quesries are fine, it is the INSERT queries that we are having problems with.
We keep getting an exception when we try to insert data into the database when the "Finish" button is clicked. And if you press the continue button on the exception dialog, and then you press finish again, you get a different exception.
Exception from the first attempt
System.ArgumentException: No mapping exists from DbType Object to a known SqlDbType.
at System.Data.SqlServerCe.SqlCeType.FromDbType(DbType type)
at System.Data.SqlServerCe.SqlCeParameter.set_DbType(DbType value)
at WindowsApplication1.usersDataSetTableAdapters.UsersTableAdapter.InitCommandCollection()
at WindowsApplication1.usersDataSetTableAdapters.UsersTableAdapter.get_CommandCollection()
at WindowsApplication1.usersDataSetTableAdapters.UsersTableAdapter.Name(String name1)
Pressed "Continue"
Exception from the second attempt
System.NullReferenceException: Object reference not set to an instance of an object.
at WindowsApplication1.usersDataSetTableAdapters.UsersTableAdapter.Name(String name1)
Here is the code around the area that throws the exception:
Does anyone know what could be causing this? Because I am completely clueless.
We keep getting an exception when we try to insert data into the database when the "Finish" button is clicked. And if you press the continue button on the exception dialog, and then you press finish again, you get a different exception.
Exception from the first attempt
System.ArgumentException: No mapping exists from DbType Object to a known SqlDbType.
at System.Data.SqlServerCe.SqlCeType.FromDbType(DbType type)
at System.Data.SqlServerCe.SqlCeParameter.set_DbType(DbType value)
at WindowsApplication1.usersDataSetTableAdapters.UsersTableAdapter.InitCommandCollection()
at WindowsApplication1.usersDataSetTableAdapters.UsersTableAdapter.get_CommandCollection()
at WindowsApplication1.usersDataSetTableAdapters.UsersTableAdapter.Name(String name1)
Pressed "Continue"
Exception from the second attempt
System.NullReferenceException: Object reference not set to an instance of an object.
at WindowsApplication1.usersDataSetTableAdapters.UsersTableAdapter.Name(String name1)
Here is the code around the area that throws the exception:
VB Syntax (Toggle Plain Text)
Function GetUserName() As String If TypeOf My.User.CurrentPrincipal Is _ Security.Principal.WindowsPrincipal Then ' The application is using Windows authentication. ' The name format is DOMAIN\USERNAME. Dim parts() As String = Split(My.User.Name, "\") Dim username As String = parts(1) Return username Else ' The application is using custom authentication. Return My.User.Name End If End Function Public username As String = GetUserName() Dim usersTableAdapter As New usersDataSetTableAdapters.UsersTableAdapter() Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click name = (Form1.TextBox1.Text + " " + Form1.TextBox2.Text + " " + Form1.TextBox4.Text) usersTableAdapter.Name(name) usersTableAdapter.Attention(Form1.ComboBox1.Text, name) usersTableAdapter.At_Ease(Form1.ComboBox2.Text, name) usersTableAdapter.Hand_Salute(Form1.ComboBox3.Text, name) usersTableAdapter.Present_Arms(Form1.ComboBox4.Text, name) usersTableAdapter.Order_Arms(Form1.ComboBox5.Text, name) usersTableAdapter.Rest(Form1.ComboBox6.Text, name) usersTableAdapter.About_Face(Form1.ComboBox7.Text, name) usersTableAdapter.Right_Face(Form1.ComboBox8.Text, name) usersTableAdapter.Left_Face(Form1.ComboBox13.Text, name) usersTableAdapter.Eyes_Right(Form1.ComboBox14.Text, name) usersTableAdapter.Ready_Front(Form1.ComboBox15.Text, name) usersTableAdapter.Forward_March(Form3.ComboBox1.Text, name) usersTableAdapter.Quick_Time(Form3.ComboBox2.Text, name) usersTableAdapter.Double_Time(Form3.ComboBox3.Text, name) usersTableAdapter.Mark_Time(Form3.ComboBox4.Text, name) usersTableAdapter.Half_Step(Form3.ComboBox13.Text, name) usersTableAdapter.Halt(Form3.ComboBox5.Text, name) usersTableAdapter.Right_Step(Form3.ComboBox6.Text, name) usersTableAdapter.Left_Step(Form3.ComboBox7.Text, name) usersTableAdapter.Change_Step(Form3.ComboBox8.Text, name) usersTableAdapter.To_The_Rear(Form3.ComboBox14.Text, name) usersTableAdapter.Right_Flank(Form3.ComboBox9.Text, name) usersTableAdapter.Left_Flank(Form3.ComboBox10.Text, name) usersTableAdapter.Rout_Step(Form3.ComboBox11.Text, name) usersTableAdapter.Parade_Rest(Form3.ComboBox12.Text, name) End Sub
Does anyone know what could be causing this? Because I am completely clueless.
Last edited by killdude69; Jun 2nd, 2009 at 9:33 am.
•
•
Join Date: Jul 2008
Posts: 45
Reputation:
Solved Threads: 1
I was looking for it, but I couldn't really find it. Sorry. I guess I could have tried harder to find it. But eh, close enough, right? Anyways, the problem has actually been solved, I just can't figure out how to delete the thread. Because marking it as solved would keep it here.
This forum doesn't have the same thread tool setup as other vBulletin forums.
This forum doesn't have the same thread tool setup as other vBulletin forums.
•
•
Join Date: Mar 2009
Posts: 814
Reputation:
Solved Threads: 148
Well for future reference...
The C#.NET forum on this site is...
http://www.daniweb.com/forums/forum61.html
and the VB.NET forum is...
http://www.daniweb.com/forums/forum58.html
and perhaps PMing a MOD might solve the other problem...
Glad you got it solved...
Good Luck
The C#.NET forum on this site is...
http://www.daniweb.com/forums/forum61.html
and the VB.NET forum is...
http://www.daniweb.com/forums/forum58.html
and perhaps PMing a MOD might solve the other problem...
Glad you got it solved...
Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.
Thanks
Thanks
![]() |
Similar Threads
- Datasets and dbnull values (C#)
- SQL format exception (ASP.NET)
- problem with sql on dataset (VB.NET)
- display information from access table in a combobox (Visual Basic 4 / 5 / 6)
- JDBC Connection Pooling : Network Adapter could not establish the connection (Java)
- Display data in separate controls (SQL) (VB.NET)
- how to create a sql table through coding in vb.net (IT Professionals' Lounge)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Find Average of 4 numbers
- Next Thread: Can't open "DLL" File
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





