|
Thanks for your reply..
but can i have a sample application/code
bcz i tried it by writing a code as u mentioned
i had a 70MB file that contain more than 8,000,00 rows
the code is as follows
foreach(DataColumn dc in dt.Columns)
{
this.grd.Columns.Add(dc.ColumnName,dc.Caption);
}
Object[] obj = new Object[dt.Columns.Count];
foreach (DataRow dr in dt.Rows)
{
int i = 0;
foreach (object ob in dr.ItemArray)
{
obj[i] = ob;
i++;
}
grd.Rows.Add(obj);
i = 0;
}
|
|
|
|
|
That is a lot of rows for a grid! You may want to look into dynamic loading (a few rows at a time). This is how I normally load a DataGridView:
foreach(DataColumn dc in dt.Columns)
{
this.grd.Columns.Add(dc.ColumnName,dc.Caption);
}
int totalRows = dt.Rows.Count;
this.grd.Rows.Add(totalRows);
DataRow dr;
for (int i = 0; i < totalRows; i++)
{
dr = dt.Rows[i];
this.grd.Rows[i].Tag = dr;
this.grd.Rows[i].Cells[0].Value = dr["FirstColumn"].ToString();
this.grd.Rows[i].Cells[1].Value = dr["SecondColumn"].Tostring();
}
|
|
|
|
|
I am using Crystal Reports in my application I made using Visual Studio.NET.
I installed my application on the client machine, with all the DLLs
required(added the merge modules), the engine and the rest. When I start my
application and, from it, try to open up a report I get an exception "Query
engine error: C:\WINDOWS\Temp\temp_*******.rpt" with some wierd numbers
instead of *******. Can anyone tell me what the problem is here and how to
solve it. I am running the application on Windows 98.
|
|
|
|
|
What is the error message that is normally a bit of a clue?
|
|
|
|
|
santhoshmohan wrote: some wierd numbers
Define "weird numbers"? How is one number any more or less weird than another. For example, is 8 more or less weird than 17? And what about 42? How weird is that?
|
|
|
|
|
Hi all,
I would like to know something about performance tuning.
My doubt is I have A stored procedure for selecting data from a traxn' table.In that SELECT command, i want to invoke a UDF(find its count or sum like...).
Is it affects the perfomance of selecting data from DataBase???
Thnkx in advance
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
I would suggest you could have first glimpsed at the various typographical and lexical gaps in the post that you have made.
1) Even whilst mobile phones are now equipped with state-of-the-art dictionaries to dissuade user from cryptic ambiguous text messaging, there seems to be a little-to-more ambiguities over here:
Vipin dev wrote: traxn'
Vipin dev wrote: Thnkx
Did it mean 'HIGH VOLTAGE <small>TRACTION</small> ' or 'TRANSACTION '?
|
|
|
|
|
Sorry Mr.Vasudevan
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
Using a UDF within a stored procedure can have negative performance effects as it must run for every record it pulls form the database.
|
|
|
|
|
Hi , here's my query result.
I want to filter out the column with NULL values. How can I do it ?
Dept Name Newyork LA Washington City1 SanFrn City2
Department1 0 0 0 NULL 1 NULL
Department2 4 0 0 NULL 2 NULL
Department3 0 0 0 NULL 0 NULL
Thanks in advance,
|
|
|
|
|
SELECT DeptName,ISNULL(NEWYORK,0),ISNULL(LA,0) from MYTABLE WHERE....
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
Dear Vipin dev,
Actually, I just want to remove the columns with NULL value. If I use ISNULL(NEWYORK,0), the column still in the result set and column name is 0.
Is there anyway I can do it ?
Thanks in advance,
|
|
|
|
|
|
hi check out this
select * from tablename where col is null or col='NULL'
|
|
|
|
|
I think what you want is COALESCE
select COALESCE(fieldname, 0)
COALESCE will select the first non null from a list so you can even have
select COALESCE(field1,field2,field3,field4, 0)
|
|
|
|
|
Hi
How can i check Day Light saving time in sql.
I know there is a inbuilt function called ISDST in C# , but i want that check to be done in Sql procedure.Thanks in Advance
Regards
DilipRam
|
|
|
|
|
|
Hi, all
select convert(varchar,(datediff(dd,'1979-09-04 12:34:50.603',getdate())/365))
here getdate()='2007-09-05 12:34:50.603'
I need find the age of employee but this result is showing 28 instead of 27
because till one day is required to complete 27...
Praveen Kumar
|
|
|
|
|
How are you getting the age, Are you using DATEDIFF ?
|
|
|
|
|
Try something like this for a more accurate result:
SELECT
YEAR(GETDATE()) - YEAR('1979-09-04 12:34:50.603') -
CASE
WHEN DATEPART(dayofyear,GETDATE()) < DATEPART(dayofyear,'1979-09-04 12:34:50.603') THEN 1
ELSE 0
END AS Age
|
|
|
|
|
Why do you use
<br />
<br />
DATEDIFF(YY, @tartdate, getdate())<br />
<br />
<br />
<br />
|
|
|
|
|
Hi
I have table with three columns
col1, col2, col3
i need distinct values of col1 with any values in col2 and col3, eg if data is
1, A, A
1, B, B
2, C, C
i need my query to bring
1, A, A or 1, B, B (only one not both)
2, C, C
i need query for this. i cannot use select dintinct col1, col2, col3 from table due to 2nd row. i am using sql server.
Regards
Shajeel
|
|
|
|
|
Shajeel wrote: I have table with three columns
col1, col2, col3
i need distinct values of col1 with any values in col2 and col3, eg if data is
1, A, A
1, B, B
2, C, C
i need my query to bring
1, A, A or 1, B, B (only one not both)
2, C, C
Don't know which version of SQL Server you are using. If 2000 then below written sql will solve the problem. If you are using 2005 then you can use ROW_NUMBER() instead of IDENTITY() and there is no need for #TempTable. If you are using 2000 and table has a Identity column then also there is no need for #TempTable.
Identity Column or the higher version (2005) will help you to do in single sql stmt...
select <br />
IDENTITY(INT, 1, 1)AS KeyCol, Col1, col2, col3 into #TempTable from tbldistinct<br />
<br />
select col1,col2,col3 from #TempTable B<br />
where (Select Count(*) from #TempTable A where A.col1 = B.col1 and A.KeyCol <= B.KeyCol) =1<br />
<br />
Drop Table #TempTable
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
|
Use a groupby would be the easiest why without DISTINCT
<br />
select col1, col3, col3<br />
from table<br />
ORDER BY col1, col3, col3<br />
|
|
|
|