
pelikan
Avatar/Signature-
Posts
90 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by pelikan
-
maybe this would help. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadonet/html/odatanet2.asp
-
there are lots of possible ways to get schema metadata. 1. As you stated GetOleDbSchemaTable is one way. The nice thing about this is that it is generic, will work with any provider that is SQL compliant - Access, Excel, SQL Server etc. 2. You could query SQL Server's INFORMATION_SCHEMA tables (thats actually what GetOleDBSchemaTable does) choose just the columns you need. 3. The only thing like ADOX for SQL Server is the COM library SQL-DMO, with this, not only do you get all metadata, but you can completely administer the server - probably overkill in most cases. 4. You probably already know about getting specific schema info thru the DataAdapter. (FillSchema() or MissingSchemaAction.AddWithKey). 5. with VS you could use SQLXML to stream out metadata in XML format. It would take a little work, but you could set up a Strongly Typed DataSet from the GetOleDbSchemaTable tables - then tailor the class produced by Xsd.exe
-
Creating my own MS Office Framework for .net
pelikan replied to AlexCode's topic in Interoperation / Office Integration
You have to use interop to bridge between managed code and COM - no way around it. Office is COM. You can produce strong named, versioned interop assemblies - but I believe MS has already done so - so you can use their published versions. These are called PIA's (Primary Interop Assemblies) http://www.microsoft.com/downloads/details.aspx?FamilyID=c41bd61e-3060-4f71-a6b4-01feba508e52&DisplayLang=en -
Export dataview content from VB.NET to Excel
pelikan replied to Nick_Net2004's topic in Interoperation / Office Integration
check out this article: http://support.microsoft.com/default.aspx?scid=kb;en-us;317719 or search with (excel export) in the MSDN Library -
imports an unregistered object
pelikan replied to nasejohann's topic in Interoperation / Office Integration
SharpDevelop does the same thing VS Studio does - just right click Add References in the Project pane - browse to your dll or tlb and you're ready to rock and roll. (note: both VS Studio and SharpDevelop use tlbimp in it's simplest, most basic no option form. For more control read this article: http://www.msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dndotnet/html/useframewktools.asp -
OK Dan. Should we all wear red pants and sport green hats with feathers too?
-
the best way to learn the utility of these objects is to do things the hard way - i.e. program your data access using raw API calls in C++. I guarantee you will see the light.
-
Converting C# COM object to VB.NET
pelikan replied to Rest's topic in Interoperation / Office Integration
ain't no such animal as a C# COM object. even if there were, why would you want the poor thing to put on VB airs? -
are you catching the OleDbException (which is thrown by OleDbConnection)? it has an OleDbErrorCollection with OleDbError objects. Message NativeError : Jet's Error message in your case Source SQLState In any event, I suspect the error is yours and not the users - check the docs on Jets NativeError and try and figure out what you're doing wrong
-
Maybe sending WM_SETREDRAW (using the Handle of the tab control) you'd send the message with WPARAM = FALSE to the Tab control. do your updating, send the message again with WPARAM = TRUE I've done this a lot with C++, but never with a tab control and not managed code. when you do this the window is not repainted until you reset the redraw flag - works wonders with the rich edit control.
-
the hierarchy is implicit in the chapters table. you can extract and traverse the hierarchy with recursive code - you do this building treeviews anyway - ex. //create the DataRelation for the self referencing foreign key ds.Relations.Add("SelfRReferenceRelation", tblChapter.Columns["chapter_id"], tblChapter.Columns["parent_chapter_id"], false); //later on building the treeview //for each book create a new root level node //then //b is your current book DataRow //create the book node foreach (DataRow drChapter in b.GetChildRows("BookChapter")) { if (drChapter.IsNull("parent_chapter_id")){ DisplayChapter(drChapter, null); } } //recursive function void DisplayChapter(DataRow r, TreeNode parentNode){ //if parentNode is null add a new child to current book node //else add a new subchapter to parentNode using data in r // the node you create here - chapternode is passed recursively below foreach (DataRow subRow in r.GetChildRows("SelfReferenceRelation")){ //recursive call DisplayChapter(subRow, chapternode); } }
-
you need a third table if you want to deepen the hierarchy: (chapterID, subChapterID, SubChapter) sub-chapter to a sub-chapter to a sub-chapter... ?? your design is wrong. try: book_id //the book in which this chapter or sub-chapter exists chapter_id //the id of this chapter parent_chapter_id //the parent chapter of the chapter (chapter_id) or null if top level chapterContent chapter_title chapter_author etc. this is your second table - parent_chapter_id is a foreign key into the same table. An example of this can be seen in the Northwinds Employees table and the reports_to column which references another employee_id in the same table.
-
Access Database get Autoincrement Value
pelikan replied to cpopham's topic in Database / XML / Reporting
Access is a wrapper for Jet 4.0 - @@IDENTITY syntax is used by Jet -
Access Database get Autoincrement Value
pelikan replied to cpopham's topic in Database / XML / Reporting
jeez louise! talk about ugly hacks! if you are using Access 2000 (Jet 4.0) and you are inserting via SQL INSERT INTO statement - you can use the SELECT @@IDENTITY query to retrieve new aoutoincrement values - it returns the last auto value generated on your connection. -
I think you fret needlessly - the CLR maintains the reference count on the COM object just as any other COM client and releases the object when the count goes to 0 (not during GC) so you can treat the object as if it were GC'ed, but the GC isn't really involved.
-
Check out the open source IDE SharpDevelop. Although the program has some flaws, it is still quite flexible - and free.
-
poor VB has legacy problems which stretch back into the mists of time when B.G. was working out of a garage. Learn a clean elegant syntax - C#.
-
too bad you're using VB. With C# you could just add the same delegate(method) to each event, then find out which control fired the event (say a Tag property on the sender).
-
Another dumb question involving datagrids
pelikan replied to cpopham's topic in Database / XML / Reporting
You don't sat what kind of DataGrid - Windows, Web ? No matter. Some advice. Most programming these days is event driven - think event - the user takes some action to delete the row - trap the event - query state - take appropriate action. I just started learning ADO.NET, C# and the Framework 2 weeks ago, so I hesitate to offer specific pointers on the DataGrid which is a very complex control. -
Obtain list of installed Data providers
pelikan replied to Luigi's topic in Database / XML / Reporting
don't know if this is what you want but... you could use the Data Links dialog box (same one used by VS) 1. Add references to the librarys: Microsoft OLE DB Service Component 1.0 Microsoft ActiveX Data Objects 2.7 2. Launch the dialog and use the returned connection string MSDAC.DataLinks d = new MSDAC.DataLinksClass(); ADODB.Connection c = new ADODB.ConnectionClass(); d.PromptEdit( ref c ); Console.WriteLine( c.ConnectionString ); of course these are OLE DB connection strings. -
removing a datarow from a datatable
pelikan replied to cpopham's topic in Database / XML / Reporting
Don't understand where you have a problem. if the PONum is unique, set it as the Primary key constraint on the table. DataTable t = dsAGPOs.Tables["AGPO"]; t.PrimaryKey = new DataColumn[] { t.Columns["PONum"] }; //..... //let user delete requested PONum (wherever) DataRow r = t.Rows.Find( sPONumToDelete ); if ( r != null ) { t.Remove( r ); } //all done, row gone -
DataGrid - showing one to one relation in column
pelikan replied to thomas10001's topic in Database / XML / Reporting
You guys are way off base! From my reading of the original post, what is needed is a column based on an "expression". You have to get used to the NET way of doing things. No JOINS, no complicated queries or views. DataRelations between base tables in the DataSet are used. Set it up this way: //add the relation (Staff is the "parent" table here) ds.Relations.Add("StaffDept", ds.Tables["Staff"].Columns["staffId"], ds.Tables["Departments"].Columns["staffId"], false); //add expression based columns to the Departments table for each look-up //field ds.Tables["Departments"].Columns.Add("First Name", typeof(string), "Parent(StaffDept).firstName"); ds.Tables["Departments"].Columns.Add("Last Name", typeof(string), "Parent(StaffDept).lastName"); //set the Visible property of the staffId column in the DataGrid to false //bind the DataGrid to the Departments table (view) The simple and correct way to solve the problem in .NET. -
removing a datarow from a datatable
pelikan replied to cpopham's topic in Database / XML / Reporting
DataAdapters aren't bound to DataSets. A data set has no knowledge or reference to any DataAdapter and any DataAdapter can be used to fill any DataSet. -
--- more on the problem of synchronization --- if you want to sync the details with the selected item in a combo box, a little more work is required. 1) You have to obtain a reference to the BindingManagerBase for the master list. BindingManagerBase mMgr = this.BindingContext[mData, "Master"]; 2) for some reason - by design - the CurrencyManager will not coerce the selected index in a bound combo box when the position changes, you have to implement this manually by hooking events. Set up an event handler for the combos SelectedIndexChanged event. //do this after you bind the combo box and instantiate the BindingManagerBase this.cboMaster.SelectedIndexChanged += new System.EventHandler(this.cboMaster_SelectedIndexChanged); 3) In the event handler set the position property void cboMaster_SelectedIndexChanged(object sender, System.EventArgs e) { mMgr .Position = cboMaster.SelectedIndex; } 4) the grid displays the Master's current row's child rows when the position property changes in mMgr.