|
We have an app made in C# which promtes users for a sql query at run time, this has become difficult for the users but we were thinking of an easy to use query builder to integrate & instead of writing from scratch we were were wondering if there were available tools to use ??
|
|
|
|
|
I do not know of a query-builder per se, but at one time we had to generate reports where the functionality would be similar to what you want to do. But like you said, it is difficult for users to write full blown queries, and not only that but you could also run into security problems...
The solution we came up was using templates (SQL Server 2000)...where we had multiple queries defined and users would click on the the most appropriate report type, enter some parameters and bingo, get a report back. A template might look like this:
<?xml version="1.0"?>
<data xmlns:sql='urn:schemas-microsoft-com:xml-sql'>
<sql:header>
<sql:param name="fieldid">0000</sql:param>>
</sql:header>
<sql:query>
Select CustomerName 'name' From dbo.Customer where gender = @fieldid for xml raw
</sql:query>
</data>
This would return the data in xml format (dat as root) - which can be routed through xslt to output nicely formatted result (text/html etc).
This is just an idea - I am sure there are other options out there. This worked well for us as we had more control over every aspect and we could add more "reports" as needed by users. Let me know if you want to pursue this option and I'll point you into the right direction.
|
|
|
|
|
what do u about SQL-DMO is there any possibility to use the functionality?
|
|
|
|
|
Sorry, never used it.
...think concepts, teach to learn...
|
|
|
|
|
i have a database in access, and need information from one table, to be displayed based on textbox value. I have tried repeatedly, and just cant get it. Here is the problem all help greatly appriciated.
database: upsdb.mdb
table: calpackage
columns: sm_trackingno, sm_referencetext0
I am trying to pull the referencetext0 and display as a label with the following:
select sm_referencetext0, sm_trackingno from calpackage where sm_trackingno = txttrack.text
label.text=sm_referencetext0
TIA
|
|
|
|
|
I hope that's pseudo code.
SqlCommand cmd = new SqlCommand("SELECT sm_referencetext0 FROM calpackage WHERE sm_trackingno = @trackingNo", myConnection);
string result = cmd.ExecuteScalar();
label.Text = result; The above code assumed you already have a connection called myConnection and it is open.
Does this help?
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
Colin's answer was more or less correct. Since you are using Access, you need to use the OleDb * classes.
using(OleDbConnection conn = new OleDbConnection(connString))
{
OleDbCommand cmd = new OleDbCommand("SELECT sm_referencetext0 FROM calpackage WHERE sm_trakingno = ?", conn);
cmd.Parameters.Add("param1", txttrack.Text);
label.Text = (string) cmd.ExecuteScalar();
} For the connection string for your database, check http://www.connectionstrings.com[^], but it should look something like this:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;User Id=admin; Password=;"
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hello friends!!!!!!!!!!!!!
I expand "Management"
then I expand "Current Activity"
then I expand "Locks / Object"
in the tree on the left side (not the opened window) I see a list of
databases and the objects in each database currently with a lock placed on it.
Most of the listings in this tree are something like:
Northwind.dbo.Categories
but what I'm seeing for one particular database is something like this:
Northwind.jdoe.Categories
Normally I make all objects owned by dbo, however I have some systems that
require another user to be the object owner. such example. However the owner of all the objects is not this "jdoe", but
let's say "jsmith". In which case I would expect the tree listing the
objects being locked to look like this:
Northwind.jsmith.Categories
NOT
Northwind.jdoe.Categories
especially, as I stated previously, since jdoe is just a valid user in
the db.
So, I'm still confused..
How could I remove this jdeo????????????????????
I will remove him by sp_changedbowner.
but why and how that 'jdoe' comes in picture!!!!!!!!!!
Is there any perticular command or login type work because of
that 'jdoe's' name came into picture?????????????????
Help Me Out!!!!!!!!!!!!!!!!
Regards
shashank
|
|
|
|
|
Hi,
I'm a newbie in this but I what to make a VB.NET application that adds a jpg picture to row in a SQL Server 2000 database.
Thanks in advance.
Dino Sousa
|
|
|
|
|
1 you can create a proc first like:
create proc p_pic_i
@filename nvarchar(100),
@filesize int,
@jpgdate image
as
insert into pic (
filename,
filesize,
filedata)
values (
@filename,
@filesize,
@filedata)
if @@rowcount = 1 and @@error = 0
return @@identity
else
return -1
go
2 then write a function to call this proc, sorry this is c# not vb.net
public int csf_p_News_ext_i(
string filename,
int filesize,
byte[] filedata,
SqlConnection conn)
{
SqlCommand cmd = new SqlCommand("p_News_ext_i",conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@RETURN_VALUE",SqlDbType.Int,4);
cmd.Parameters["@RETURN_VALUE"].Direction =
ParameterDirection.ReturnValue;
cmd.Parameters.Add("@filename",SqlDbType.NVarChar,200);
cmd.Parameters["@filename"].Value = filename;
cmd.Parameters.Add("@filesize",SqlDbType.Int,4);
cmd.Parameters["@filesize"].Value = filesize;
cmd.Parameters.Add("@filedata",SqlDbType.Image);
cmd.Parameters["@filedata"].Value = filedata;
int retvar = -1;
try
{
conn.Open();
SqlDataReader reader = cmd.ExecuteReader();
retvar = (int)cmd.Parameters["@RETURN_VALUE"].Value;
}
catch
{
retvar = -1;
}
return retvar;
}
3 read stream(asp.net)
Byte[] FileByteArray = new Byte[filelength];
Stream StreamObject = UpFile.InputStream;
StreamObject.Read(FileByteArray,0,filelength);
|
|
|
|
|
Hi,
It looks like a great solution especially since I want to start to use store procedures. But it covers the upload do the database part... Can you help me with the download from database part too?
Thanks in advance,
Dino Sousa
|
|
|
|
|
asp.net,
try
{
SqlDataReader reader = this.oCon.GetReader(
@"select filesize,contenttype,filedata from file_personal
(index=pk_file_personal nolock) where fileid = " + e.Item.Cells[5].Text);
this.Page.Response.ContentType = (string)reader["contenttype"];
this.Page.Response.AppendHeader("Content-Disposition:",
"attachment; filename=" +
HttpUtility.UrlEncode(e.Item.Cells[7].Text));
this.Page.Response.OutputStream.Write((byte[])reader["filedata"],
0, (int)reader["filesize"]);
this.Page.Response.End();
}
catch
{
this.Page.RegisterStartupScript("",
"alert('error!');");
return;
}
ASP.NET Windows APP Mobile App
http://www.eReach.cn
|
|
|
|
|
Hi
Im trying to create an Microsoft Access Database using the SQL "CREATE DATABASE" command, but very attempt I have used has lead to an exception, so if anyone out there has an answer to my problem I would REALLY appriciate it
Wilye
|
|
|
|
|
can any one suggest how to perform
Tranfering of files and folders from one server to another server using asp.net
|
|
|
|
|
|
Hi there!
I have a activex dll written in vc++ 6.0
There is one function that needs to receive a Ado Recordset from a VBasic application. It seems that after the VB does the call to the function, the ADORecordset loses at least one property: Sort.
The function is receiving the ADORecordset as an IDispatch.
Any ideia is a good idea to this problem...
Thanks in advance.
António Carvalho
|
|
|
|
|
Hey guys, how do I:
SELECT AVG(SomeDateTimeColumn) FROM TimeLog WHERE EMPID=12345
Any useful script for lazy me? Thanks in advance.
Norman Fung
|
|
|
|
|
i don't understand neither your question nor your explaining sql query...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
You can't AVG a datetime. I am not sure what you are getting at.
|
|
|
|
|
hi
i need code 4 currency convertor
automatic convert the currency
4 payment in online hotel reservation
thanx
viren
|
|
|
|
|
virendra kumar wrote:
i need code 4 currency convertor
It is a simple multiplication or division. Also, this question does not seem to have anything to do with databases.
Source currency * or / exchange rate = destination currency.
e.g. Pounds Sterling to US Dollars. Exchange rate: £1 == $1.87
£5 * 1.87 = $9.35
or US Dollars to Pounds Sterling
$10 / 1.87 = £5.34
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
virendra kumar wrote:
online hotel reservation
Maybe you need this.[^]
<italic>Work hard, Work effectively.
|
|
|
|
|
|
In my database i got:
ID, Name, Type, Comment
But when i fill to grid. my Columns reorder:
Comment, ID, Name, Type
But i want to have an ordier like in database. How can be done.
I used the tutorial on web:
http://www.c-sharpcorner.com/Tutorials/OleDbDataAdapterDesign.asp
I am using Jet 4.0 as connection
I have noticed if i change select statment, but there isn't any effect.
I hope i dit posted this on correct forum.
Can anybody help me. Thanks in advance.
|
|
|
|
|
I think the problem is in your grid. How do you fill the grid?
<italic>Work hard, Work effectively.
|
|
|
|