|
hi
i wanted to perform a search for records based on the date range specified by the user..
the input method is in mm/dd/yyyy in the webform
before going to the web from i just queried the table using the query builder and it constructed a query
SELECT patient.*
FROM patient
WHERE (Dt BETWEEN CONVERT(DATETIME, '2006-08-09 00:00:00', 102) AND CONVERT(DATETIME, '2006-09-09 00:00:00', 102))
now how do i use the same query to the webform... also how will i display the results in a gridview control..
also.. shud i create an stored procedure, by which i can make this possible
thx
Kunal
|
|
|
|
|
A stored proc is always a better idea. You can just pass a DateTime as a param to a stored proc
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
like this
<br />
<br />
create proc getrecords<br />
<br />
@StartDate datetime,<br />
@EndDate datetime<br />
<br />
AS<br />
<br />
SELECT patient.*<br />
FROM patient<br />
WHERE (Dt BETWEEN @StartDate AND @EndDate)<br />
<br />
<br />
go<br />
|
|
|
|
|
For searching data between two dates, you can also write the query as follows: Suppose that you want to search data between 01/03/2007 and 31/103/2007
Select field1, field2, datefield from tablename
where datediff(day,'01/03/2007',datefield) >= 0 and datediff(day,'31/03/2007',datefield) <=0 order by datefield
Meeram395
|
|
|
|
|
Hi all,
I'm using OLEDB to reading data from an excel file, using connection string below:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1";
The problem I'm get in stuck in is OLEDB just read an excel file which have to have the first row is header, and then data row.
My excel file is formatted to use 6 beginning rows for introduction (not have any data), row 7 as header, then below is data row.
I couldn't read the file...Please help me!
Thanks in advance.
|
|
|
|
|
As you have discovered, Oledb will not handle that format. You will have to use the Excel automation / interop to handle that (bizarre) format.
|
|
|
|
|
Thank you. Please give me hint about that...
|
|
|
|
|
HI,
Which Data Type accepts both image and character in one sql column?
Thanks
|
|
|
|
|
You can store an address of image file and use a HyperLink in runtime
|
|
|
|
|
TEXT : but you have to encode the image data to base64 (ie text).
|
|
|
|
|
I want to increase the no of rows to prevent the backcolor of the Grid View
When I tried to increase DataGridrows as :
If Me.DataGridView1.RowCount < 20 Then DataGridView1.RowCount = 20
the error message :
RowCount property cannot be set on a data-bound DataGridView control.
can I deal with that to increase no of rows
jooooo
|
|
|
|
|
Since the grid is bound to a dataset, the number of rows in the dataset determine what is displayed in the grid. Why not just change the backcolor of the grid to match the backcolor of a row?
|
|
|
|
|
you are right ..
but I made alternating rows color ,, and some cells has it's own backcolor ,, then I can't make a single color
I hope you are see
jooooo
|
|
|
|
|
I guess you are just out of luck then.
|
|
|
|
|
|
hi,
I want to know if there is a way - other than backup and restore database - to transfer all the data from one database on the server to another on a local SQLServer. it has to be done daily, so that the manager will always have an updated copy of the data on his machine.
Thanks in advance
|
|
|
|
|
I guess you could set up replication to do this as well. It might be kind of a pain depending on the number of tables and things like that.
Hope that helps.
Ben
|
|
|
|
|
ok, thanks. but can you give me any site or reference so i can try the replication, because i don't know much about it,
thanks,
|
|
|
|
|
Have you tried using Google.
|
|
|
|
|
|
How complicated is your database? You could use SMO and transfer to move the database to the new database. The transfer method is a little gimpy, but pro grammatically it allows you to move the entire database and relations to a different server.
_____________________________________________________________________
Our developers never release
code. Rather, it tends to escape, pillaging the countryside all around.
The Enlightenment Project (paraphrased comment)
Visit Me at GISDevCafe
|
|
|
|
|
I need some help.
I want to create a dropdownlist with the options "Day" "Week" and "Month". I need to write a stored procedure so that if the user selects "Day" then he only queries the day(Today), if he selects "Month" he must get the data for the month.
How will I go about doing this? I know I should use the If...Else or CASE in C#. I want to know how the Stored Procedure will look?
Thanks Guys !!! and GALS!!!
Illegal Operation
Making Computer Software Talk
|
|
|
|
|
Here you go, this is really simple and you should consider doing better date arith with DAY using CONVERT
<br />
create proc myproc <br />
<br />
@Type as varchar(10)<br />
<br />
AS<br />
BEGIN<br />
<br />
if @Type = 'DAY'<br />
BEGIN<br />
select * <br />
from table<br />
Where YEAR(DATE) = YEAR(getdate())<br />
and MONTH(DATE) = MONTH(getdate())<br />
and DAY(DATE) = DAY(getdate()) <br />
END<br />
<br />
if @Type = 'MONTH'<br />
BEGIN<br />
select * <br />
from table<br />
Where YEAR(DATE) = YEAR(getdate())<br />
and MONTH(DATE) = MONTH(getdate())<br />
END<br />
<br />
<br />
if @Type = 'YEAR'<br />
BEGIN<br />
select * <br />
from table<br />
Where YEAR(DATE) = YEAR(getdate())<br />
<br />
END<br />
<br />
<br />
<br />
END<br />
go<br />
<br />
|
|
|
|
|
Hi Friend'z...
I need to update the database tables though datagrid only.(in windows form c#).
How can I update the database through datagrid ? pl help me in doing this.
thanks in advance,
|
|
|
|
|
is it a datagrid or datagridView?
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|