|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Re: inner join with parameters on 2 DataTablesto write code to implement the join. You might also want to check out this web-site that promises to provide a ..NET component to allow full SQL syntax queries against a DataSet. http://queryadataset.com Hope this helps Ad. Show quote "Joe1714" wrote: > Clarification: > I have a DataSet m_ds with 2 tables: TestCases and TaskTests. I want to do a > join on these 2 DataTables. It appears that I am unable to do so without a > Connection object ( to a database ). This is not desirable since I populated > the DataTables and DataSet by reading an XML file - TestCases.xml. > Is there a way to do this join without requiring a Connection to the Database? > Since the DataSet is suppose to be an in memory representation of a > database, you would think this is possible and desirable... > > m_ds = new DataSet(); > m_ds.ReadXml(Server.MapPath("TestCases.xml")); > > // Create select string > > string SqlString = String.Format( "Select T.testcase_id As TestCase, T.name, > T.module, T.server, T.result " + > "From " + m_ds.Tables["TestCases"] + " T INNER JOIN " + > m_ds.Tables["TaskTests"] + " Tk ON T.testcase_id = Tk.testcase_id "); > > // SqlDataAdapter myCommand = new SqlDataAdapter( SqlString, m_Connection ); > > SqlDataAdapter myCommand = new SqlDataAdapter(); > myCommand.SelectCommand = new SqlCommand( SqlString ); > > // Note. this Fill command causes Excepion.Message -> > // Fill: SelectCommand.Connection property has not been initialized > // i.e. a Connection to a database is apparently required!!! > > myCommand.Fill( m_ds, "tcs" ); > > dataGrid.DataSource=m_ds.Tables["tcs"]; > dataGrid.DataBind(); > > Thanks - Joe > > "Joe Celko" wrote: > > > Please post DDL, so that people do not have to guess what the keys, > > constraints, Declarative Referential Integrity, datatypes, etc. in your > > schema are. Sample data is also a good idea, along with clear > > specifications. > > > > Did you ever think how hard it is to debug code when you cannot see it? > > > > --CELKO-- > > > > *** Sent via Developersdex http://www.developersdex.com *** > > Don't just participate in USENET...get rewarded for it! > >
Other interesting topics
|
|||||||||||||||||||||||