|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Unable to Created Data ViewI 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 *** Hi,
Are you sure that there is not "nothing" returned, there are quite a few parameters which can prevent that. Cor Show quoteHide quote "OutdoorGuy" <Outdoor***@fishing.com> schreef in bericht news:OQSOnx%23FHHA.4464@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 ***
App.Config Recovers automatically
PrintPreview Control Context Menu Not Closing code to find all dynamic control locations on a form??? Consume webservice within intranet from internet Command Line Arguments making shortcuts to start MsAccess Add items with value and text to a combobox Clear spaces between tex Problem using serial port in vb2005 |
|||||||||||||||||||||||