Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Doug G
Constraint Violating Yak Guru
331 Posts |
Posted - 2002-03-11 : 20:47:10
|
Is there anything like a Query Analyzer window in an Access Data Project? I haven't been able to find a spot to write an ad-hoc query within an adp.Thanks,======Doug G====== |
|
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2002-03-11 : 21:19:49
|
quote: Is there anything like a Query Analyzer window in an Access Data Project?
What about creating your own?Create a form Create a textbox on the form called txtSQL, multiline etcCreate a textbox called txtOut, multiline etcCreate a button called cmdRunAnd then something like:Public Sub cmdRun_Click()Dim cnxn as New ADODB.ConnectionDim rst as New ADODB.RecordsetDim fld as FieldDim sOUT as Stringcnxn.Open gsProviderrst.Open txtSQL.Text, cnxnIf NOT (rst is nothing) then IF NOT rst.EOF then 'Column Heads For each fld in rst.Fields sOut = sOut & fld.Name & chr(9) Next 'Data Do While NOT rst.EOF For each fld in rst.Fields sOut = sOut & Cstr(rst.Fields(fld.Name)) & chr(9) Next rst.moveNext sOut = sOut & vbcrlf Loop End ifEnd iftxtOut.Text = soutMe.repaintSet rst= nothingSet cnxn = nothingEnd Sub Of course, that's just a hack to get going - so how about when you're done, posting back the finished code? Thanks - I'd love it. --I hope that when I die someone will say of me "That guy sure owed me a lot of money"Edited by - rrb on 03/11/2002 21:21:38 |
 |
|
|
|
|