Ask a Question related to ASP.NET General, Design and Development.
-
wilco #1
how to search a database with a stored procedure?
hello,
can any one tell me how to create a stored procedure that is beable to
search a table, or more table's and can make use of wildcards?
i just made somthing like this,:
SELECT * FROM tblUsers WHERE Adress LIKE '* Value from user how wants to
search the database *'
but I don't know where to place the @??? for the input
i also wants to make the user can select witch table and field he want's to
search.
thanks!!
wilco Guest
-
Stored Procedure
EXEC master..xp_cmdshell 'cscript c:\path\file.vbs' EXEC master..xp_cmdshell 'c:\path\file.exe' "Kannan" <gk_i@yahoo.com> wrote in message... -
stored procedure help
Hi all! I am in need of writing a few stored procedures. The first one is to create a stored procedure to recover a database from backup and the... -
stored procedure value
How can I bind a stored procedure value to a page? I've executed a stored procedure and there should be two column values created...i.e. col1 and... -
NULL in search stored procedure, VB.NET
Hi I am using a stored procedure to search a single table with "COALESCE(@param,param)" but the NULL default value is being ignored. I think... -
Stored procedure from stored procedure
Is it possible to create a stored procedure from a stored procedure? When I attempt this inanity, it doesn't blow up until syntax error at the... -
Jerry III #2
Re: how to search a database with a stored procedure?
And when you do it like this someone will sumbit "%' GO DELETE tblUsers --"
in your input box and wipe out your table (if the database user has enough
privileges to do so).
A better solution is to use the command object, like this:
OleDbCommand cmd = new OleDbCommand();
cmd.CommandText = "SELECT * FROM [tblUsers] WHERE [Address] LIKE @address";
cmd.Parameters.Add("@address", "%" + txtAddress.Text + "%");
Jerry
"David Wier" <dwier@nospamASPNet101.com> wrote in message
news:%239pMFNrWDHA.1680@tk2msftngp13.phx.gbl...> Dim sAddress as String
> sAddress=txtAddress.text
> SQL = "SELECT * FROM tblUsers WHERE Adress Like '%" & sAddress & "%'"
>
> Put the % sign on the front and at the end, in order to search the entire
> field
>
> Check out this 2 Part Tutorial on Parameterized Queries:
> [url]http://aspnet101.com/aspnet101/tutorials.aspx?id=1[/url]
>
> LIKE is covered in Part 2
>
> David Wier
> [url]http://aspnet101.com[/url]
> [url]http://aspexpress.com[/url]
>
>
> "wilco" <wilco.bikker@hetnet.nl> wrote in message
> news:bgm62m$oou$1@reader11.wxs.nl...> to> > hello,
> >
> > can any one tell me how to create a stored procedure that is beable to
> > search a table, or more table's and can make use of wildcards?
> > i just made somthing like this,:
> > SELECT * FROM tblUsers WHERE Adress LIKE '* Value from user how wants to
> > search the database *'
> > but I don't know where to place the @??? for the input
> > i also wants to make the user can select witch table and field he want's>> > search.
> >
> > thanks!!
> >
> >
>
Jerry III Guest
-
Xavier MT #3
Re: how to search a database with a stored procedure?
Can I ask what is the difference?
I just want to understand it....
"Jerry III" <jerryiii@hotmail.com> wrote in message
news:%23Z1C%23ssWDHA.1480@tk2msftngp13.phx.gbl...tblUsers --"> And when you do it like this someone will sumbit "%' GO DELETE@address";> in your input box and wipe out your table (if the database user has enough
> privileges to do so).
>
> A better solution is to use the command object, like this:
>
> OleDbCommand cmd = new OleDbCommand();
>
> cmd.CommandText = "SELECT * FROM [tblUsers] WHERE [Address] LIKEentire> cmd.Parameters.Add("@address", "%" + txtAddress.Text + "%");
>
> Jerry
>
> "David Wier" <dwier@nospamASPNet101.com> wrote in message
> news:%239pMFNrWDHA.1680@tk2msftngp13.phx.gbl...> > Dim sAddress as String
> > sAddress=txtAddress.text
> > SQL = "SELECT * FROM tblUsers WHERE Adress Like '%" & sAddress & "%'"
> >
> > Put the % sign on the front and at the end, in order to search theto> > field
> >
> > Check out this 2 Part Tutorial on Parameterized Queries:
> > [url]http://aspnet101.com/aspnet101/tutorials.aspx?id=1[/url]
> >
> > LIKE is covered in Part 2
> >
> > David Wier
> > [url]http://aspnet101.com[/url]
> > [url]http://aspexpress.com[/url]
> >
> >
> > "wilco" <wilco.bikker@hetnet.nl> wrote in message
> > news:bgm62m$oou$1@reader11.wxs.nl...> > > hello,
> > >
> > > can any one tell me how to create a stored procedure that is beable to
> > > search a table, or more table's and can make use of wildcards?
> > > i just made somthing like this,:
> > > SELECT * FROM tblUsers WHERE Adress LIKE '* Value from user how wantswant's> > > search the database *'
> > > but I don't know where to place the @??? for the input
> > > i also wants to make the user can select witch table and field he>> > to> >> > > search.
> > >
> > > thanks!!
> > >
> > >
> >
>
Xavier MT Guest



Reply With Quote

