|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Typed DataSetAccording to a Microsoft article a typed dataset is available through
intellisense and can be accessed like in this example: TextBox1.Text = NorthwindDataSet.Customers(3).ContactName I have created the Typed DataSet after microsoft recomandations and it's available in the object browser, but this is where my problem begins.. I work in VB obviously, but the objects from the Dataset apears as C#... strange. I haven't seen any setting for changing this to VB. I guess this is the reason I can't access the dataset as in the example above. Can anyone point me in the right direction, please? That would be much appreciated! - Jørn "Jørn Jensen" <jorn.jen***@mp3pro.no> schrieb Where do you see C# code? Do you get compiler errors? If you can access it > According to a Microsoft article a typed dataset is available > through intellisense and can be accessed like in this example: > > TextBox1.Text = NorthwindDataSet.Customers(3).ContactName > > I have created the Typed DataSet after microsoft recomandations and > it's available in the object browser, but this is where my problem > begins.. I work in VB obviously, but the objects from the Dataset > apears as C#... as mentioned above, where do you see the problem? > strange. I haven't seen any setting for changing this to VB. I guess Armin> this is the reason I can't access the dataset as in the example > above. Browsing the Object Browser, the available methods are presented in a C#
syntax, and the root node has a C# icon. Intellisense shows: myDataSet.myTableDataTable, myDataSet.myTableRow, myDataSet.myTableRowChange etc... But no columns. When I try to compile I get this message: "Reference to a non-shared member requires an object reference." This happens compiling only this line of code (in the page_load event) Dim strTest As String = dsPmsItem.tablePmsItem(3).Artist The DataSet I created works perfectly when I do a preview from the DataSet designer. (thanks for your reply!) *** Sent via Developersdex http://www.developersdex.com *** "Jørn Jensen" <jorn.jen***@mp3pro.no> schrieb This is strange. Did you add a new C# project to the solution? (Dumb > Browsing the Object Browser, the available methods are presented in > a C# syntax, and the root node has a C# icon. question, maybe). Show quoteHide quote > Intellisense shows: Are you sure you created a dataset object? Is dsPmsItem the name of the > > myDataSet.myTableDataTable, myDataSet.myTableRow, > myDataSet.myTableRowChange etc... But no columns. > > When I try to compile I get this message: > "Reference to a non-shared member requires an object reference." > > This happens compiling only this line of code (in the page_load event) > > Dim strTest As String = dsPmsItem.tablePmsItem(3).Artist > > The DataSet I created works perfectly when I do a preview from the > DataSet designer. typed dataset class or is it a variable you've declared on your own (or dropped on the Form using the designer)? Armin I didn't add a C# project =)
I added a DataSet called PmsItem.xsd to the App_Code folder. Then I completed the wizard, created stored procedures and ended up with a functioning DataSet. The Table name from my SQL database was pretty silly, so I changed the Name of the DataSet to dsPmsItem and the name of the (only) table in the DataSet to tablePmsItem. I changed the names in the properties window in the DataSet designer and did a successful "Preview Data..." after. I tried something new now: I declared new dataset: Dim dsPmsItem As New dsPmsItem And used the same statement on page_load as before: Dim strTest As String = dsPmsItem.tablePmsItem(0).Artist lblLabel1.Text = strTest This worked, but it didn't return anything. And I got an error saying that that the index number must not exceed the number of rows, or the column name doesn't not excist, or etc.. The dataset apears to be empty... Obviously, since I created it as New. How do I fill it? *** Sent via Developersdex http://www.developersdex.com *** "Jørn Jensen" <jorn.jen***@mp3pro.no> schrieb I'm afraid, I don't know this folder because I'm creating Winforms> I didn't add a C# project =) > > I added a DataSet called PmsItem.xsd to the App_Code folder. applications only. Show quoteHide quote > Then I Use a DataAdapter or an OleDBDataReader/SqlDataReader.> completed the wizard, created stored procedures and ended up with a > functioning DataSet. The Table name from my SQL database was pretty > silly, so I changed the Name of the DataSet to dsPmsItem and the > name of the (only) table in the DataSet to tablePmsItem. > > I changed the names in the properties window in the DataSet designer > and did a successful "Preview Data..." after. > > I tried something new now: > > I declared new dataset: > > Dim dsPmsItem As New dsPmsItem > > And used the same statement on page_load as before: > > Dim strTest As String = dsPmsItem.tablePmsItem(0).Artist > lblLabel1.Text = strTest > > This worked, but it didn't return anything. And I got an error > saying that that the index number must not exceed the number of > rows, or the column name doesn't not excist, or etc.. > > The dataset apears to be empty... Obviously, since I created it as > New. How do I fill it? More about ADO.Net: http://msdn.microsoft.com/library/en-us/cpguide/html/cpconaccessingdatawithadonet.asp "Creating and Using DataSets": http://msdn.microsoft.com/library/en-us/cpguide/html/cpconcreatingusingdatasets.asp "Using a DataSet with Existing Data": http://msdn.microsoft.com/library/en-us/cpguide/html/cpconusingdatasetwithexistingdata.asp "Populating a DataSet from a DataAdapter": http://msdn.microsoft.com/library/en-us/cpguide/html/cpconpopulatingdatasetfromdataadapter.asp Armin
MsgBox("test") no msg box?
Type 'OleDbConnection' no define Getting the hWnd of an IE window from an NT service The free format? Variable that holds the record count of a result set? Question on Dataset navigation vb.net Generate all possible maches from a regular expression. Confusion: VB Express/VC Express/Sql Server Express Edition Using control array run time with different control names How to know if Windows firewall is on or off? |
|||||||||||||||||||||||