Type Conversion Error....

  • Thread starter Thread starter Smith John
  • Start date Start date
S

Smith John

I have set Option Explicit On
I am getting the error for the below line.
dim myDataSet as new dataset
dim dv as DataView = myDataSet.Tables("myTable")

I am using .Net Framework 1.1.
Please advice.
Thanks
Smith
 
Smith, the tables collection returns a DataTable object not DataView.
try
dim dt as DataTable = myDataSet.Tables("myTable")
 
I wanted to sort the data by column name. That is my ultimate goal.
Please see below about my previous post.
Thanks,
Smith

John Morales said:
Smith, the tables collection returns a DataTable object not DataView.
try
dim dt as DataTable = myDataSet.Tables("myTable")




**************************************************************
Thank you Karl for the soultion.
This step involves converting the data to dataview which involves few CPU
cycles.
Before implementing this I want to make sure there is no other method which
is build in the dataset or dataset table is available.
Thanks,
Smith





Karl Seguin said:
dim dv as DataView = myDataSet.Tables("myTable")
dv.Sort = "MyColumn ASC"
DataGrid1.DataSource = dv
DataGrid1.DataBind()

Karl

***********************************************************
 
Hello Smith,

Try

Dim dv as DataView = myDataSet.Tables("myTable").DefaultView

to get the DataView or,

Dim dt as DataTable = myDataSet.Tables("myTable")

to get the DataTable.
 
Hello Smith,

Dim dv as DataView = myDataSet.Tables("myTable").DefaultView
dv.Sort = "MyColumn ASC"
DataGrid1.DataSource = dv
DataGrid1.DataBind()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top