Okay, I'm new to the whole ADO.NET stuff, so don't punish me to hard if I ask a total bullshit question...
First, here's a piece of code (assume, aDataSet is already initialized and the table "aTable" also exists):
Dim aRow As DataRow
For Each aRow In Me.mDataSet.Tables("aTable").Rows
aRow.Item("isParent") = True
What I wanna do: Add the new column "isParent" to "aTable" (okay, I managed this), and initialize it with a standard value (I do this in the for-next-loop). But I thought, there must be a more elegant way to do this, without picking every single cell in a loop. Anyone know a good solution?
I don't need to write in a database, 'cause my aDataSet is build on the fly, without database representation.
U can enter only enter those values in table2(Rank) which are present in Primary Key.
This is the fundamental of having a foreign key. If you want to add values other than those in primary key remove the constraint.
I have multiple results for 1 user. In the example I want the results to get to one row, with the final result (True, True, True, True, True).
So the query has to go through all the results and check if the Access Right is True or False. Is one of them is True the result of the column is true.
I tried to use Temp Tables but im stuck Anyone has an idea?
which would be much easier to query (you can join on ID; you can select on right=true, etc), as well as easier to extend when new access numbers become necessary.
Luc Pattyn [Forum Guidelines][My Articles] The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
You can have your column type as XML and SqlDbType[^] enum supports XML type. You can write something like,
using (SqlConnection conn = /* ... */)
using (SqlCommand cmd = new SqlCommand("insert into your_table VALUES(@xml_content)", conn))
cmd.Parameters.Add("@xml_content", SqlDbType.Xml).Value = new SqlXml(reader);
// other code
SqlXml can take a Stream or a XmlReader instance.
For reading data, work with the SqlDataReader.GetSqlXml()[^] method. SqlXml.ReadOuterXml() will give you a string representation of the XML.