Similar Threads:
1.Manipulating data between data adapters
Hi
I have two data adapters bound to two separate tables. How can I;
1. Loop through all records one by one in one of them while reading column
values, and
2. Insert a record from data adapter A into data adapter B
via code?
Thanks
Regards
2.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
3.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) "
4.how to verify the data set filling the right data table
Hi all,
I am now writing 1 stored procedure(sp) which execute
other 2 sp, therefore result of 2 data set and 2 dataset
tables. But how can I ensure the right dataset filling
the right tables so that .net crystal report can access
the table's result to generate report.
Please help me, it drive me nearly crazy because I cannot
generate the subreport. Please help me.
P.S. I want 2 sp are independent for query. But just have
1 key of them can be joined.
Thanks and regards,
Hello
5.Serializing data set with de-normalized data
I have a DataSet where some data items are actually objecy ot type string[].
If I output a schema using DataSet.WriteXmlSchema() using , I get:
<xs:element name="ItemName" msdata:DataType="System.String[], mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
type="xs:string" minOccurs="0" />
Accessong these items works fine in code:
//C#
string[] results = (string[])row["ItemName"];
But when I try to use the DataSet.WriteXml() method to serialize the data,
the output does not contain the desired data:
<CustomerID>System.String[]</CustomerID>
Clearly the serializer is calling the item value's ToString() method intread
of recognizing that it is a string array and digging deeper. I think I
understand why; the proper way to structure such a DataSet is to normalize
it such that "multi-valued" items are stored in a separate table with a data
relation.
Yet, I have to deal with the DataSet I have. Is there any option for
overriding how certain items are serialized and deserialized? Or am I stuck
with writng my own serializer from scratch?
6. Data Sets Vs Data Readers
7. Passing parameter for Stored Procedure to Data Adapter/Data Set
8. can data be retrieved from a data set or do I need to use a da