can data be retrieved from a data set or do I need to use a data t

dotnet framework

    Next

  • 1. Filling a list box from a table
    Hi VS2008. I have a table in an access database. How can I fill a list box with a column from the table? Thanks Regards
  • 2. A question on Objectdatasource???
    Scenario : In a single webform, I have bill data(master data like billno,date,remarks.. ) and bill details(multiple entries in a grid like item details). While saving data to it should be stored in Billdata(Bill no-primarykey) , Billdetails(Bill no-foreignkey) tables accordingly. For this scenario i want to use objectdatasoure/customised objectdatasource for all insert,update and delete cases. Is this can be acheived thru objectdatasource? is there any alternative way where we can have resuable kind of control/class which performs all the transactional operations(similar to objectdatasource)??
  • 3. Best Practices for Data Access
    Dear all, I need to design an smart client application that can run on mulitple and plugable backend like MS SQL, Oracle or MySQL. Also the smart client is accessing the database from the internet. What is the best approach? Thanks. Regards, Kueh.

Re: can data be retrieved from a data set or do I need to use a data t

Postby Val Mazur » Thu, 22 Jul 2004 11:58:57 GMT

Hi,

Do you need to compare values in a different datatables? If yes, then there 
is no direct way to do this, but you could do next thing. If one of the 
table has a primary key then you could relate two datatables and navigating 
through the one table, you could get related records from another one

-- 
Val Mazur
Microsoft MVP









Similar Threads:

1.can data be retrieved from a data set or do I need to use a da

Hi,

In this case you could probably just use Select method of the DataTable to 
select all the rows , which match specific condition, into array. For 
example

Dim loRows() as DataRow

loRows=MyDataSet.Tables(0).Select("INT=2 or INT=4")

Now you will have an array, which will contain all the matching datarows and 
you could analyze this array

-- 
Val Mazur
Microsoft MVP


"Paul" < XXXX@XXXXX.COM > wrote in message 
news: XXXX@XXXXX.COM ...
> Hi Val, thanks for the response.  I am just doing a simple comparison. 
> The dataset is 1 column of data with 3 rows like
> ****************
> *Prim key    * Int      *
> ****************
> *   1          *    2      *
> ****************
> *   2          *   4       *
> *****************
> *  3           *    2      *
> ****************
> then I  just need to check if value in Int column is a 2 or a 4.  Just 
> thought there might be an easy way to get the values of int column out of 
> the dataset.  Looks like
> creating a datatable from the data set may be the way to go.
> Thanks
> -- 
> Paul G
> Software engineer.
>
>
> "Val Mazur" wrote:
>
>> Hi,
>>
>> Do you need to compare values in a different datatables? If yes, then 
>> there
>> is no direct way to do this, but you could do next thing. If one of the
>> table has a primary key then you could relate two datatables and 
>> navigating
>> through the one table, you could get related records from another one
>>
>> -- 
>> Val Mazur
>> Microsoft MVP
>>
>>
>> "Paul" < XXXX@XXXXX.COM > wrote in message
>> news: XXXX@XXXXX.COM ...
>> >I have a simple data set with 1 column, 3 rows of an integer type.  I 
>> >need
>> >to do a comparison on the data and tried to copy it into an array but 
>> >the
>> >copy method did not seem to work.  I ended up creating a datatable, 
>> >loading
>> >the table with the dataset and then getting the data out of the 
>> >datatable.
>> >Seems like there should be an easier way to do this, comparing with 
>> >dataset
>> >elements directly or data table elements directly.
>> > thanks.
>> > Paul G
>> > Software engineer.
>>
>>
>> 


2.problem with data adapter and data set while inserting and retrieving data

i am using a data adapter and a dataset for filling and retrieving data
into .mdb database.
following is the code.....

for the form load event
  Dim dc(0) As DataColumn
        Try
            If OleDbConnection1.State = ConnectionState.Closed Then
                OleDbConnection1.Open()
            Else
                MsgBox("connection can not be established")
            End If
            DA.Fill(DataSet11, "Table1")
            cmd = New OleDbCommandBuilder(DA)
            dc(0) = DataSet11.Tables("Table1").Columns("EmpID")
            DataSet11.Tables("Table1").PrimaryKey = dc
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        Delete.Enabled = False
    End Sub

for  inserting values into the DB

Private Sub Insert_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Insert.Click
        Dim dr As DataRow
        dr = DataSet11.Tables("Table1").NewRow
        dr.Item(0) = Val(TB1.Text)
        dr.Item(1) = TB2.Text
        dr.Item(2) = TB3.Text
        dr.Item(3) = Val(TB4.Text)
        dr.Item(4) = TB5.Text
        DataSet11.Tables("Table1").Rows.Add(dr)
        DA.Update(DataSet11, "Table1")
        MsgBox("data is saved")
        rno = 0
        call filldata()

filldata function consists of the following

 With DataSet11.Tables("Table1").Rows(rno)
         TB1.Text = Trim(.Item(0))
         TB2.Text = Trim(.Item(1))
         TB3.Text = Trim(.Item(2))
         TB5.Text = Trim(.Item(4))
         End With

the error it gives is " there is no row at
0........system.nullreference...........i checked the connection and
its working fine and also the database is getting accessed........the
error is occuring at the line " With
DataSet11.Tables("Table1").Rows(rno) "

3.Data Adapters, Data Sets, Data TableMappings, and XML

Here's what I'm trying to do:

1. Create a data adapter with Select and Insert commands.

2. Use DataTableMappings to map XML tags into columns in a 
data base table.

3. Create a dataset

3. Read in a schema using dataset.ReadXmLSchema

4. Read in an xml file that contains the data using 
dataset.Read XML

5. Add 3 new columns to the dataset. (These columns have 
already been mapped in step 2).

6. Put data in the 3 new columns.

7. Modify some data in the other columns using xpath 
queries to find the nodes that need changing.

8. Use datadapter.update(dataset, tablename)

Everything seems to work fine until step 8. I get all the 
data, the extra columns get added, and the data in other 
columns gets modified. When I execute step 8 I get:

Run-time exception thrown : 
System.InvalidOperationException - Cannot add or remove 
columns from the table once the DataSet is mapped to a 
loaded XML document.

Any ideas about how I can either fix this or do it another 
way.

TIA,
Candi

4.Need help with populating table control with data from a data set

Hi,

I don't have much knowledge of the table control. I am basically trying to 
use a table thats populated with data rows from a dataSet but currently 
things aren't working for me.

below is the sample HTML that I have:

<asp:TableRow>
	<asp:TableCell Text="Company" ID="CompanyCode" 
Runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
	<asp:TableCell Text="Paygroup" ID="PaygroupCode" 
Runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
	<asp:TableCell Text="paygroup descr" ID="PaygroupDescr" 
Runat="server"></asp:TableCell>
</asp:TableRow>

------------

In addition, I think I need some VB code to assign the particular data rows 
to the table columns, but I'm not sure of the syntax:

 Table1.ID("Company") = Dr("Company")

Any help would be much appreciated.


Thanks,

Gavin





-- 
You've got to live and learn...

5.updating a datagrid using a data adpater and data set

6. Data Set Base Default Vaules done

7. how to verify the data set filling the right data table

8. Serializing data set with de-normalized data



Return to dotnet framework

 

Who is online

Users browsing this forum: No registered users and 99 guest