473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Unable to Created Data View

Greetings,

I am attempting to use the following code in order to create a DataView
(in VB.NET 2003). However, on the "Dim dv as New DataView" line I am
receiving a "Type expected" error. Any ideas?

Thanks in advance!

************************************************** ******
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim sqlConn As New SqlClient.SqlConnection
....
sqlComm.Connection = sqlConn
sqlComm.CommandText = "Select * from Books"

Dim da As New SqlClient.SqlDataAdapter
da.SelectCommand = sqlComm

Dim ds As New DataSet

Try
da.Fill(ds, "Books")

Dim dv As New DataView(ds.Tables("Books"), " ", "Author",
DataViewRowState.CurrentRows)
--"'Type Expected' error occurs here"

Dim frow As Integer
frow = dv.Find("Simpson")

ListBox1.Items.Add(dv(frow)("Author").ToString() & " " &
dv(frow)("Title").ToString())

Catch er As Exception
MsgBox(er.Message)

End Try

*** Sent via Developersdex http://www.developersdex.com ***
Dec 4 '06 #1
1 1095
Hi,

Are you sure that there is not "nothing" returned, there are quite a few
parameters which can prevent that.

Cor

"OutdoorGuy" <Ou********@fishing.comschreef in bericht
news:OQ****************@TK2MSFTNGP03.phx.gbl...
Greetings,

I am attempting to use the following code in order to create a DataView
(in VB.NET 2003). However, on the "Dim dv as New DataView" line I am
receiving a "Type expected" error. Any ideas?

Thanks in advance!

************************************************** ******
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim sqlConn As New SqlClient.SqlConnection
...
sqlComm.Connection = sqlConn
sqlComm.CommandText = "Select * from Books"

Dim da As New SqlClient.SqlDataAdapter
da.SelectCommand = sqlComm

Dim ds As New DataSet

Try
da.Fill(ds, "Books")

Dim dv As New DataView(ds.Tables("Books"), " ", "Author",
DataViewRowState.CurrentRows)
--"'Type Expected' error occurs here"

Dim frow As Integer
frow = dv.Find("Simpson")

ListBox1.Items.Add(dv(frow)("Author").ToString() & " " &
dv(frow)("Title").ToString())

Catch er As Exception
MsgBox(er.Message)

End Try

*** Sent via Developersdex http://www.developersdex.com ***

Dec 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Marcus | last post by:
I have a database containing my own tables and data and I wanted to be able to query this against an accountancy program which has an ODBC driver. This was never a problem with MS Access and Jet...
0
by: S Stone | last post by:
Visual Studio is unable to display the XSD for editing. When I attempt to open one from the solution explorer, part of the editing surface attempts to display the XSD but it never fully repaints...
2
by: mar10 | last post by:
I've been working on a database with several tables that I've established relationships for. I needed to add some fields to one of the tables and before I did anything to my current table I...
3
by: David | last post by:
Hello, I have a datagrid populated with rows from a view. Because they are from a view, the rows are not actual database records, and therefore lack unique identifiers. So I have a command...
4
by: Mike Fellows | last post by:
running IIS on a single server, hosting pages on an intranet basis, one single user out of 50 is having an unable to validate data issue how do i fix this (the microsoft KB is a little...
0
by: James Crowley | last post by:
Hi everyone, My site is randomly firing off a "ExceptionHttpException : Unable to validate data. " error on some of its forms at the moment: ------- HttpException : Unable to validate data....
7
by: James Crowley | last post by:
Hi everyone, My site is randomly firing off a "ExceptionHttpException : Unable to validate data. " error on some of its forms at the moment: ------- HttpException : Unable to validate data....
6
by: tshad | last post by:
I have an object I am unable to put in my session. I have others that have no problem. The difference is the the one I am having problems with was created in VS 2003. The others were created...
6
by: tshad | last post by:
I had asked about this before, but have been unable to solve the problem. Could this be a problem with Web Services? I have 4 web services that I reference in this object. There is only one...
0
by: geeteshss | last post by:
the present problem is that i am unable to display data in datagrid....... but the data is visible in database..below is the code what should i do...earlier i could view it also below this code is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.