473,385 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help developing a SQL Query tool

Hello All

I am trying to find some information on how to design/develop a SQL Query tool embedded in an ASP.NET web application
What I would like to have is a tool that helps a user write SQL statements that are in turn used to query a database. The results of the query will then be displayed in a DataGrid. I'd like the tool to help the user write the query (similar to a Query By Example tool). I currently have a web app that allows a user to directly enter a SQL statement in text box and then the user can click a button and execute that query and display the results in a DataGrid (users are restricted to select statements only, no UPDATE, INSERT, DELETE, etc).

I'm sure someone has already (or tried to develop) developed a tool like this to embed in a web application. I've searched
the Internet for while now and haven't found any good examples yet. Does anyone have any ideas/suggestions on wher
to find info on developing a tool like this

Thank
Donnie
Nov 18 '05 #1
2 1363
Try this query, it may help you populate some of the tools controls. It
returns a limited subset the databses structure

SELECT sysobj.name AS 'Table',syscol.name AS 'Column',CASE WHEN syscol.name
IN ( index_col(object_name(sysobj.id), sysind.indid,
1),index_col(object_name(sysobj.id), sysind.indid,
2),index_col(object_name(sysobj.id), sysind.indid,
3),index_col(object_name(sysobj.id), sysind.indid, 4) )THEN 1 ELSE 0 END AS
'PrimaryKey',systypes.name AS 'Datatype',syscol.length AS
'Length',syscol.prec AS 'Precision',ISNULL(syscol.scale,0) AS 'Scale',
syscol.isnullable AS 'Nullable', object_name(FKeys.rKeyid) AS
'ForeignTable',col_name(FKeys.rKeyid, FKeys.rkey) AS 'ForeignColumn',(SELECT
col_name(FKeys.rKeyid, min(colid)) FROM syscolumns sysDescCol Where
sysDescCol.id = FKeys.rKeyid AND sysDescCol.xtype IN (167,175)) AS
'ForeignDescription',(SELECT col_length
(object_name(FKeys.rKeyid),col_name(FKeys.rKeyid, min(colid))) FROM
syscolumns sysDescCol Where sysDescCol.id = FKeys.rKeyid AND
sysDescCol.xtype IN (167,175)) AS 'DescriptionLength' FROM sysobjects sysobj
JOIN syscolumns syscol ON sysobj.id = syscol.id Join systypes ON
syscol.xtype = systypes.xtype AND systypes.xtype = systypes.xusertype JOIN
sysindexes sysind ON sysobj.id = sysind.id AND (sysind.status & 2048) <> 0
LEFT JOIN sysforeignkeys FKeys ON sysobj.id = FKeys.fkeyid AND syscol.colid
= FKeys.fkey WHERE sysobj.type = 'U' AND sysobj.name <> 'dtProperties' ORDER
BY 1, 3 DESC, 2

"Donnie" <an*******@discussions.microsoft.com> wrote in message
news:27**********************************@microsof t.com...
Hello All-

I am trying to find some information on how to design/develop a SQL Query tool embedded in an ASP.NET web application. What I would like to have is a tool that helps a user write SQL statements that are in turn used to query a database. The results of the query will
then be displayed in a DataGrid. I'd like the tool to help the user write
the query (similar to a Query By Example tool). I currently have a web app
that allows a user to directly enter a SQL statement in text box and then
the user can click a button and execute that query and display the results
in a DataGrid (users are restricted to select statements only, no UPDATE,
INSERT, DELETE, etc).
I'm sure someone has already (or tried to develop) developed a tool like this to embed in a web application. I've searched the Internet for while now and haven't found any good examples yet. Does anyone have any ideas/suggestions on where to find info on developing a tool like this?

Thanks
Donnie

Nov 18 '05 #2
Not sure what this is supposed to bring but for me it just brings error
messages.

Lloyd Sheen

"Felbrigg" <so*****@microsoft.com> wrote in message
news:eu****************@TK2MSFTNGP10.phx.gbl...
Try this query, it may help you populate some of the tools controls. It
returns a limited subset the databses structure

SELECT sysobj.name AS 'Table',syscol.name AS 'Column',CASE WHEN syscol.name IN ( index_col(object_name(sysobj.id), sysind.indid,
1),index_col(object_name(sysobj.id), sysind.indid,
2),index_col(object_name(sysobj.id), sysind.indid,
3),index_col(object_name(sysobj.id), sysind.indid, 4) )THEN 1 ELSE 0 END AS 'PrimaryKey',systypes.name AS 'Datatype',syscol.length AS
'Length',syscol.prec AS 'Precision',ISNULL(syscol.scale,0) AS 'Scale',
syscol.isnullable AS 'Nullable', object_name(FKeys.rKeyid) AS
'ForeignTable',col_name(FKeys.rKeyid, FKeys.rkey) AS 'ForeignColumn',(SELECT col_name(FKeys.rKeyid, min(colid)) FROM syscolumns sysDescCol Where
sysDescCol.id = FKeys.rKeyid AND sysDescCol.xtype IN (167,175)) AS
'ForeignDescription',(SELECT col_length
(object_name(FKeys.rKeyid),col_name(FKeys.rKeyid, min(colid))) FROM
syscolumns sysDescCol Where sysDescCol.id = FKeys.rKeyid AND
sysDescCol.xtype IN (167,175)) AS 'DescriptionLength' FROM sysobjects sysobj JOIN syscolumns syscol ON sysobj.id = syscol.id Join systypes ON
syscol.xtype = systypes.xtype AND systypes.xtype = systypes.xusertype JOIN
sysindexes sysind ON sysobj.id = sysind.id AND (sysind.status & 2048) <> 0
LEFT JOIN sysforeignkeys FKeys ON sysobj.id = FKeys.fkeyid AND syscol.colid = FKeys.fkey WHERE sysobj.type = 'U' AND sysobj.name <> 'dtProperties' ORDER BY 1, 3 DESC, 2

"Donnie" <an*******@discussions.microsoft.com> wrote in message
news:27**********************************@microsof t.com...
Hello All-

I am trying to find some information on how to design/develop a SQL
Query tool embedded in an ASP.NET web application.
What I would like to have is a tool that helps a user write SQL
statements that are in turn used to query a database. The results of the query will
then be displayed in a DataGrid. I'd like the tool to help the user write
the query (similar to a Query By Example tool). I currently have a web app that allows a user to directly enter a SQL statement in text box and then
the user can click a button and execute that query and display the results
in a DataGrid (users are restricted to select statements only, no UPDATE,
INSERT, DELETE, etc).

I'm sure someone has already (or tried to develop) developed a tool like this to embed in a web application. I've searched
the Internet for while now and haven't found any good examples yet.

Does anyone have any ideas/suggestions on where
to find info on developing a tool like this?

Thanks
Donnie


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
2
by: Olivier | last post by:
Hi ! I've got a problem trying to figure out a query. I have a table with following fields: tool varchar(30) last_date datetime user_id mediumint(8) ....
20
by: andy.rich | last post by:
I am getting the following error and I do not know why. Can anyone help? -------------------------------------------------------- this is what appears on the screen...
10
by: L. R. Du Broff | last post by:
I own a small business. Need to track a few hundred pieces of rental equipment that can be in any of a few dozen locations. I'm an old-time C language programmer (UNIX environment). If the only...
25
by: virg | last post by:
Hi, i have client-server application which is written in python using XMLRPC protocol. The existing client is a command line. Now client application we are converting it as Web UI using java. I...
2
by: nilandanj | last post by:
Hi, I want to solve the slow query problem...can anyone help me for this.. can anyone guide me for this that which GUI tool is helpful for me to solve slow-query???? pls give me answer as...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
1
by: TF | last post by:
This group came through for me last time so here we go again. My page shows paint colors, brand name, product code, etc in a gridview with the background matching the paint color. Several links on...
12
by: Lnwolf | last post by:
Hello, I am having an issue with my synchronized combo boxes and don't know how to fix it. I have created two boxes and have made the synchronization work (the user clicks on the first box and...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.