Problem Creating Dataset

  • Thread starter Thread starter ssdangelo
  • Start date Start date
S

ssdangelo

Dear Sir - I have
spent several days (p/t) trying to create a Dataset using V.B. Net on
my Laptop Sony. I have tried using both a Access and a SQL Server
database and the same problem occurs. I would prefer to use .Net's
wizzards to create insert, update, delete and SQL statements.....to
save time for all future development. I could probably do it all
manual, but trying to avoid doint that.

In my Form, I was able to connect to it....see the table (only two
columns)...and even "Preview Data". [b:53cdb74c6c]
However, I am not able to "Create a
Dataset"[/b:53cdb74c6c] and when I right
mouse-clicking on the DataAdapter.......the error I get is
"there were problems generating dataset. To resolve this
problem, build the project, fix any errors and then generate dataset
again visual basic .net "

I rebuilt it.....and even re-created the Project. :( [/QUOTE]
 
SSDango,

Did you:

Create a new project
Opened the toolbox and draged an oledbadapter to your form
Did all was what told in the wizard and succeeded that to the end without
error messages
Rightclicked on the "OleDbDataadapter1" what was than beneat as an icon on
your screen and clicked on generate dataset.

Without doing anything in between of that?

Cor
 
I did exactly what you suggested....no errors up to that point. The
error occurs when I then right-mouse clicked on Data Adapter and
tried creating DataSet. Here is the underlying Windows generated
code:

#Region " Windows Form Designer generated code
"

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents SqlDataAdapter1 As
System.Data.SqlClient.SqlDataAdapter
Friend WithEvents SqlSelectCommand1 As
System.Data.SqlClient.SqlCommand
Friend WithEvents SqlInsertCommand1 As
System.Data.SqlClient.SqlCommand
Friend WithEvents SqlUpdateCommand1 As
System.Data.SqlClient.SqlCommand
Friend WithEvents SqlDeleteCommand1 As
System.Data.SqlClient.SqlCommand
Friend WithEvents SqlConnection1 As
System.Data.SqlClient.SqlConnection
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.SqlDataAdapter1 = New
System.Data.SqlClient.SqlDataAdapter()
Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand()
Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand()
Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand()
Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand()
Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection()
'
'SqlDataAdapter1
'
Me.SqlDataAdapter1.DeleteCommand = Me.SqlDeleteCommand1
Me.SqlDataAdapter1.InsertCommand = Me.SqlInsertCommand1
Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1
Me.SqlDataAdapter1.TableMappings.AddRange(New
System.Data.Common.DataTableMapping() {New
System.Data.Common.DataTableMapping("Table", "School", New
System.Data.Common.DataColumnMapping() {New
System.Data.Common.DataColumnMapping("SchoolID", "SchoolID"), New
System.Data.Common.DataColumnMapping("School", "School")})})
Me.SqlDataAdapter1.UpdateCommand = Me.SqlUpdateCommand1
'
'SqlSelectCommand1
'
Me.SqlSelectCommand1.CommandText = "SELECT SchoolID, School
FROM School"
Me.SqlSelectCommand1.Connection = Me.SqlConnection1
'
'SqlInsertCommand1
'
Me.SqlInsertCommand1.CommandText = "INSERT INTO School(School)
VALUES (@School); SELECT SchoolID, School FROM School " & _
"WHERE (SchoolID = @@IDENTITY)"
Me.SqlInsertCommand1.Connection = Me.SqlConnection1
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@School",
System.Data.SqlDbType.VarChar, 50, "School"))
'
'SqlUpdateCommand1
'
Me.SqlUpdateCommand1.CommandText = "UPDATE School SET School =
@School WHERE (SchoolID = @Original_SchoolID) AND (Sch" & _
"ool = @Original_School); SELECT SchoolID, School FROM School
WHERE (SchoolID = @" & _
"SchoolID)"
Me.SqlUpdateCommand1.Connection = Me.SqlConnection1
Me.SqlUpdateCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@School",
System.Data.SqlDbType.VarChar, 50, "School"))
Me.SqlUpdateCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Original_SchoolID",
System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "SchoolID",
System.Data.DataRowVersion.Original, Nothing))
Me.SqlUpdateCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Original_School",
System.Data.SqlDbType.VarChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "School", System.Data.DataRowVersion.Original, Nothing))
Me.SqlUpdateCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@SchoolID",
System.Data.SqlDbType.Int, 4, "SchoolID"))
'
'SqlDeleteCommand1
'
Me.SqlDeleteCommand1.CommandText = "DELETE FROM School WHERE
(SchoolID = @Original_SchoolID) AND (School = @Original_" & _
"School)"
Me.SqlDeleteCommand1.Connection = Me.SqlConnection1
Me.SqlDeleteCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Original_SchoolID",
System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "SchoolID",
System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Original_School",
System.Data.SqlDbType.VarChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "School", System.Data.DataRowVersion.Original, Nothing))
'
'SqlConnection1
'
Me.SqlConnection1.ConnectionString = "data
source=DANGELO\VSdotNET;initial catalog=YorkvilleDB;integrated
security=SSPI" & _
";persist security info=False;workstation id=DANGELO;packet
size=4096"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(432, 398)
Me.Name = "Form1"
Me.Text = "Form1"

End Sub

#End Region
 
ssdangelo,

Strange, can you try it with a different table, not school, school by
instance

Cor
 
Cor - Unfortunately I'm at work now.....but I can tell you that I did
try it with different tables. I created a test table....and it
didn't work neither. I first ran into this problem using MS Access
Table.....then I installed a SQL Server engine and tried it with a
more rubust database. Same errors occured with both DB's. Also, my
laptop is in very good shape.....never had problem with it and do most
of my development work on it. I suspect that there may be some "bugs"
or problems with the early version of .Net that I have.

My ultimate goal is to avoid having to write most of the insert,
update, delete sql statements by hand (which I know I can eventualy
do). I'm trying to leverage the products ability to do some of the
"grunt" work. This evening (when I return from work), I plan on
trying the XML engine to see if I can create a "DataSet".. However,
I would still like to create the Dataset from a Table!!

Any thoughts?
 
SSdangelo,

The only thing I can think about now is that your virus checker does not
allow XSD files or something, that is the difference with an untyped
dataset.

Can you draw a dataset your self and than try to generate a dataset from
that.

Item is dataset and than just add one elemenent or something click on it
right click and than the same.

Cor
 
Cor - Don't think the Virus Scanner has
anything to do with my inablility to create dataset. However, after
looking at the error messages a bit closer last night, there is a
problem with the "Data-Table-Column-Mapping" command on the system
generated code. Unfortunately I started looking into problem late
last night and couldn't continue unraveling issue.

Unfotunately I'm at work again (it's tough when you have a mortagage
to pay!! :( ), and won't be able to look at again till end of
business day (New York Time). / Steve
 
Cor - Don't think the Virus Scanner has
anything to do with my inablility to create dataset. However, after
looking at the error messages a bit closer last night, there is a
problem with the "Data-Table-Column" command on the system generated
code. Unfortunately I started looking into problem late last night
and couldn't continue unraveling issue.

Unfotunately I'm at work again (it's tough when you have a mortagage
to pay!! :( ), and won't be able to look at again till end of
business day (New York Time). / Steve
 
SSdangelo,

However in my opinion can you try that idea from generating a dataset from a
simple XSD.

(That brings you in my opinion more close to the problem)

Cor
 
Cor - Again late last night I did create a xsd file or dataset from
the xml schema. works great. However, I have absolutely no
experience using xml per-say......and not sure if it's a simple
matter of replacing the table driven dataset with an xml one. After
work I will investigate some more....and over the Labor Day weekend.

Also, I did play with the table/column data mapping on the code
generated by .Net. No luck on that frong......but I suspect that
the problem resides in this autogenerated code and I also suspect
that the early version of .Net that I have may have some "bugs" in
it.

Thanks and talk to you later.
 
What an idiot I was. The problem resided in the naming of one of my
directories..... I had placed the following character in my path
"&"....and it did something funky with the code generator. What
a fool I was!!

Take care all and good luck!
 
* (e-mail address removed)-spam.invalid (ssdangelo) scripsit:
What an idiot I was. The problem resided in the naming of one of my
directories..... I had placed the following character in my path
"&"....and it did something funky with the code generator. What
a fool I was!!

For labels, you can set the 'UseMnemonic' property to 'False' to prevent
"&" characters from being treated as mnemonic prefixes.
 
Back
Top