Well, the DataTable property of the Typed dataset is (and should be,
by all means) ReadOnly. Why do you want to overwrite the table at
all ? Once you have converted it to a DataView, you can use the
DataView wherever you need.

On Jan 22, 9:24 pm, Nacho108 <[email protected]> wrote:
> Hi Everyone! I'm glad I'm joining the group.
>
> I'm new in c# programming and I have some doubts about datasets ,
> dataview, etc. I hope in some time I can answer and help others also.
> I'm reading a table within a database and then putting it within a
> datatable object and so far so good.
> The problem arises when I try to use typed datasets and using
> dataviews at the same time.
>
> 1) BASE_ANDataSet dt = new BASE_ANDataSet();
> 2) string sqlConnectString;
> 3) sqlConnectString = "Data Source=(local);User
> Id=sa;Password=;Initial Catalog=BASE_AN;";
> 4) string sqlSelect = @"SELECT * from ALARMS ";
> 5) SqlDataAdapter da = new SqlDataAdapter(sqlSelect,
> sqlConnectString);
> 6) da.Fill(dt);
> 7) DataView v = dt.ALARMS.DefaultView;
> 8) v.Sort = "AID";
> 9) dt.ALARMS = v.ToTable();
>
> Up to item 8 I have no problems, but then in item 9 the compiler tells
> me that dt.ALARMS is an read-only object.
>
> I tried this same code with tables and it worked just perfect.
> Please can someone help me with that?
>
> Thanks in advance !!
>
> Nacho

Reply via email to