Search Results

Search found 9 results on 1 pages for 'beta033'.

Page 1/1 | 1 

  • Linq to Datarow, Select multiple columns as distinct?

    - by Beta033
    basically i'm trying to reproduce the following mssql query as LINQ SELECT DISTINCT [TABLENAME], [COLUMNNAME] FROM [DATATABLE] the closest i've got is Dim query = (From row As DataRow In ds.Tables("DATATABLE").Rows _ Select row("COLUMNNAME") ,row("TABLENAME").Distinct when i do the above i get the error Range variable name can be inferred only from a simple or qualified name with no arguments. i was sort of expecting it to return a collection that i could then iterate through and perform actions for each entry. maybe a datarow collection? As a complete LINQ newb, i'm not sure what i'm missing. i've tried variations on Select new with { row("COLUMNNAME") ,row("TABLENAME")} and get: Anonymous type member name can be inferred only from a simple or qualified name with no arguments. Also, does anyone know of any good books/resources to get fluent?

    Read the article

  • relational data from xml

    - by Beta033
    Our problem is this, we have a relational database to store objects in tables. As any relational database could, several of these tables have multiple foreign keys pointing to other tables (all pretty normal stuff) We've been trying to identify a solution to allow export of this relational data, ideally, only 1 of the objects in the model, to some sort of file (xml, text, ??). So it wouldn't be simple enough to just export 1 table as data stored in other tables would contribute to the complete model of the object. Something like the following picture: Toward this, i've written a routine to export the structure by following the foreign key paths which exports something similar to the following. <Tables> <TableA PK="1", val1, val2, val3> <TableC PK="1", FK_A="1", Val1, val2, val3> <TableC PK="2", FK_A="1", val1, val2, val3> <TableB PK="1", FK_A="1", FK_C="1", val1, val2, val3> <TableB PK="2", FK_A="1", FK_C="2", val1, val2, val3> <TableD PK="1", FK_B="1", FK_C="1", val1> <TableD PK="2", FK_B="2", FK_C="1", val1> </Tables> However, given this structure, it cannot be placed into a heirarchial format (ie D2 is a child of C1 and B2; and B2 is a child of C2) Which in turn, makes my life very difficult when trying to identify a methodology to reimport (and reKey) these objects. Has anybody done anything like this? how do you do it? are there tools or documentation on how this is best accomplished? Thanks for your help.

    Read the article

  • operator not defined for System.Data.SqlClient.SqlConnection and System.Data.SqlClient.SqlConnection

    - by Beta033
    i hope i'm just doing something wrong here. Ideally i'm trying to open the connection, open a transaction execute a ton of prebuilt sqlstatements (with parameters) against this connection then close the connection. ideally all in the same batch. It's easy enough to wrap this all in a for loop, however i'd like to use the forEach function of the list generic to set the connection as it'll probably be faster than my implementation of calling List.Item(i) in the loop but i get some strange errors. Dim sqlStatements As List(Of SqlCommand) = New List(Of SqlCommand) Dim conn As SqlClient.SqlConnection = New SqlConnection("...") sqlStatements.Item(0).Connection = conn 'Works sqlStatements.ForEach(Function(ByRef cmd As SqlCommand) cmd.Connection = conn) 'ERROR: Operator '=' is not defined for types 'System.Data.SqlClient.SqlConnection' 'and 'System.Data.SqlClient.SqlConnection What does this error really mean?

    Read the article

  • Custom XML Serialization, how to write custom root element?

    - by Beta033
    I'm probably just doing this wrong, i know. i'm using custom serialization and when the xml is generated it's putting the class name as the root element Example: <MyClassName> <MyIntendedRootNode> <ObjectType> <Property1/> <Property2/> ... I'm inoking the serialization by calling xmlserializer.Serialize(writer,Me) so i'm sure that has something to do with it. I've tried putting XMLRoot onto the class, but i think as vb is compiling this partial class with it's aspx page, it's either overwriting this property or ignoring it entirely. ideally i'd like to just tell it to either throw away everything it has and use a different root element. Anybody else do this except me? Thanks

    Read the article

  • VB.Net List.Find. Pass values to predicate

    - by Beta033
    Having a bit of trouble using the List.Find with a custom predicate i have a function that does this private function test () Dim test As Integer = keys.Find(AddressOf FindByOldKeyAndName).NewKey here's the function for the predicate Private Shared Function FindByOldKeyAndName(ByVal k As KeyObj) As Boolean If k.OldKey = currentKey.OldKey And k.KeyName = currentKey.KeyName Then Return True Else Return False End If End Function by doing it this way means i have to have a shared "currentKey" object in the class, and i know there has to be a way to pass in the values i'm interested in of CurrentKey (namely, keyname, and oldkey) ideally i'd like to call it by something like keys.Find(AddressOf FindByOldKeyAndName(Name,OldVal)) however when i do this i get compiler errors. How do i call this method and pass in the values?

    Read the article

  • How to seralize only some properties in .Net?

    - by Beta033
    This is for a web project so i have several classes that inherit from Web.UI. I only want to serialize very particular properties (basically, only local properties) I'm aware of the XMLIgnore property that can be placed on a property to ignore items, but this won't work in my context since that would require modifying a bunch of stuff that i really don't want to modify (and probably can't). So how do i tell the xml serializer to ignore everything except for X and Y or tell it to seralize just X and Y? i could just create my own xml in a string builder or something and if that's the only way, so be it. however i'm looking for a method that will employ the built in XML stuff. Thanks

    Read the article

  • heirarchial data from self referencing table in tree form

    - by Beta033
    Ii looks like this has been asked and answered in all the simple cases, excluding the one that i'm having trouble with. I've tried using a recursive CTE to generate this, however maybe a cursor would be better? or maybe a set of recursive functions will do the trick? Can this be done in a cte? consider the following table PrimaryKey ParentKey 1 NULL 2 1 3 6 4 7 5 2 6 1 7 NULL should yield PK 1 -2 --5 -6 --3 7 -4 where the number of - marks equal the depth, my primary difficulty is the ordering.

    Read the article

  • hierarchical data from self referencing table in tree form

    - by Beta033
    It looks like this has been asked and answered in all the simple cases, excluding the one that I'm having trouble with. I've tried using a recursive CTE to generate this; however maybe a cursor would be better? Or maybe a set of recursive functions will do the trick? Can this be done in a cte? consider the following table PrimaryKey ParentKey 1 NULL 2 1 3 6 4 7 5 2 6 1 7 NULL should yield PK 1 -2 --5 -6 --3 7 -4 where the number of - marks equal the depth, my primary difficulty is the ordering.

    Read the article

1