|
You're welcome. Performance tuning is a complex topic - some would say its more of a black art than science!
Bob
Ashfield Consultants Ltd
|
|
|
|
|
That's true, although I've considered it more like playing chess. Next time I go out consulting this area, I'll take my magic wand with me. It'll make an impression (at least somekind...)
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Hi
Help me.
- Use Visual Studio 2005
- As programming language, use C#
Merge SQLite data with HTML template. This action should be done using one 'Merge' button click.
Show merged document in webbrowser.
Save merged document to PDF.
- Merger
Replaces '##[fieldname]##' in the HTML template document with data from the corresponding
column of the SQLite table.
Create one new page in the document for each record in the SQLite table.
Thank you.
Regards,
Och-Erdene
|
|
|
|
|
So what is your problem - all I see is a homework question.
Also you should read the guidlines for posting your title is not acceptable.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
Can somebody guide me on reading a password protected excel file with c#.net?
I am using VS2005, Excel 2003/2007 (? Does it make difference?)
Appreciate your help.
Thanks
Sunitha
|
|
|
|
|
One way to do that is to use Excel interop from C#. Refer to: Workbook Members (2003 System)[^].
Note, this question isn't exactly about databases so perhaps a better forum would have been for example C#[^]
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Get the password from those who protected the worksheet/workbook.
The world is a stage and most of us are desperately unrehearsed.
—Sean O’Casey, Playwright
|
|
|
|
|
Came across this artcile[^] (ROW_NUMBER)
But this is sql specific, while great help I think - if I were to use Sybase then this is not relevant. Is there anything from ADO.NET 2/3 by now? Or do we still need to implement it ourselves?
Reading up on NHibernate[^] - even they have paging facility.
Thanks
dev
|
|
|
|
|
|
Good stuff! - I think this is paging facilitated by ADO.NET (although DataAdapter only, won't help with say IDbCommand+ExecuteReader situation)
<br />
int currentIndex = 0;<br />
int pageSize = 5;<br />
<br />
string orderSQL = "SELECT * FROM Orders ORDER BY OrderID";<br />
SqlDataAdapter adapter = new SqlDataAdapter(orderSQL, connection);<br />
<br />
DataSet dataSet = new DataSet();<br />
adapter.Fill(dataSet, currentIndex, pageSize, "Orders");<br />
Have gone back in time and been doing MFC for two years - when was thsi available in dotnet I don't remember seeing it?
Thanks!
dev
|
|
|
|
|
Also yes seems Sql specific - i.e. IDataAdapter of type "SqlDataAdapter"
Example pattern:
<br />
int currentIndex = 0;<br />
int pageSize = 5;<br />
<br />
DataSet oDataSet = new DataSet("MyData");<br />
DbProviderFactory oDbFactory = System.Data.Common.DbProviderFactories.GetFactory(strProvider);<br />
IDbConnection oConn = oDbFactory.CreateConnection(); oConn.ConnectionString = strConn;<br />
IDbCommand oSqlCmd = oDbProviderFactory.CreateCommand(); oSqlCmd.CommandText = strCmd; oSqlCmd.Connection = oConn; oSqlCmd.CommandTimeout = 10000;<br />
IDataParameter param = cmd.CreateParameter(); param.ParameterName = "@employeeId"; param.Value = 1120; param.Direction = ParameterDirection.Input; cmd.Parameters.Add(param);<br />
IDataAdapter oAdapter = oDbProviderFactory.CreateDataAdapter(); oAdapter.SelectCommand = oSqlCmd; oConn.Open(); oAdapter.Fill(oDataSet, currentIndex, pageSize, "MyData"); ATTN! paging is Sql specific, i.e. oAdapter of type "SqlDataAdapter"<br />
DataView oView = oDataSet.Tables[0].DefaultView; oView.Sort = "Column1, Column2 DESC"; <br />
dev
|
|
|
|
|
Data adapter is implemented for:
- System.Data.Odbc.OdbcDataAdapter
- System.Data.OleDb.OleDbDataAdapter
- System.Data.SqlClient.SqlDataAdapter
- System.Data.OracleClient.OracleDataAdapter
I don't recall seeing paging with ExecuteReader directly. Of course if you implement a stored procedure which returns a result set and take paging position as parameter, you can use that with ExecuteReader.
I think paging has been possible from .Net framework 1.1, see: Paging Through a Query Result[^].
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
to lazy to check each but I bet paging not available to all data adapters
dev
|
|
|
|
|
devvvy wrote: I bet paging not available to all data adapters
Why not. The operation is quite simple since the adapter reads all the records, but returns only those records you define by page settings. Rest of the records are thrown away.
Also this Fill version is defined in the base class (DataAdapter) so every inherited class have this functionality.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Hi.
I want to concat some row field in a string.
for example its my view
name id
---- ---
RRR 3
eee 1
ddd 3
i want to pass the id "3" to my function and get the "RRR ddd" as my result.
sepel
|
|
|
|
|
You don't say what's your problem exactly. Create a function where id is passed as parameter and varchar as return type. In the function you fetch and concatenate the strings.
Refer to CREATE FUNCTION (Transact-SQL)[^].
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Tank you.
Mika Wendelius wrote: In the function you fetch and concatenate the strings
My problem is That function.
How i should Fetch rows?
sepel
|
|
|
|
|
|
|
Hi All
I Wount to " Select 15 & 10 " from Pervaisve Version 8 DataBase
But the Pervasive give me Error For The Sql Statment .
How To Do This Sql Statment In Pervasive 8 ?
Thanks for Any body help me
Thaer
|
|
|
|
|
I use the following code to ruturn value
SELECT Tbl_BuildingAggrement.*, Tbl_Building.*, Tbl_BuildCustomer.*, Tbl_Rent_Receipts.*, Tbl_Temple_Registration.*
FROM Tbl_BuildingAggrement INNER JOIN Tbl_Building ON Tbl_BuildingAggrement.BL_Building_Id = Tbl_Building.Build_Id
INNER JOIN Tbl_BuildCustomer ON Tbl_BuildingAggrement.BL_Cust_Id = Tbl_BuildCustomer.BuCust_Id
FULL OUTER JOIN Tbl_Rent_Receipts ON Tbl_BuildingAggrement.BL_Id = Tbl_Rent_Receipts.RntAggId
CROSS JOIN Tbl_Temple_Registration
WHERE Tbl_BuildingAggrement.BL_Building_Id =1 AND Tbl_BuildingAggrement.BL_AggDate between CONVERT(DATETIME, '22/Mar/2009', 102) and CONVERT(DATETIME, '22/Nov/2008', 102)
It display null value ,but i want to display Tbl_Temple_Registration details. that i used in this cross join.
But it didn't display values .What the Solution for this .If cross join return values .
|
|
|
|
|
I seriously think you need to use an inner join. Do some reading on join types.
If you split the selects do they both return results!
If query 1 return 3 records and query 2 return 5 records you will have 15 records in your result set.
You do not need to convert your dates to string to do the filtering, this will work
Tbl_BuildingAggrement.BL_AggDate between '22/Mar/2009' and '22/Nov/2008'
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
My question is when i use cross join it will return value or not?
All other tables other than cross join when i apply condition it will not return value .In cross join table i need to truen that values bcs it contain comapny details.I think u can understand my problem.
|
|
|
|
|
Hi all,,,
Im using Reporting services...
I ve taken Count(StudentId.value) to find out the Total number of Students for a particular year...
Now i need to SUM the Count(StudentId.Value) using expression...
Pls any one suggest some Solution...
|
|
|
|
|
I have inherited some code that runs like a pig (I think because of numerous udf calls).
I am not yet sufficiently skilled at T-SQL to figure out how to fix this, maybe someone can give me a couple of pointers?
Structure:
5 Tables:
PType ID Name
PCat ID PTypeID Name
Prod ID PCatID Name
Prop ID PTypeID Name
PropVal ID ProdID PropID Value
all ID's are Primary. All xxxID's are Foreign
In order to access PropVal Value data, the previous dev has used a udf to return the value.
This now means that heaps of sp's are littered with this function, causing what I believe are pretty serious
performance issues.
Example:
SELECT p.Name, Case When pt.Name LIKE 'IN%'
Then dbo.fGetPropVal(p.Name.'SHOT')
Else 0
End As 'SHOT',
Case When pt.Name LIKE 'EX%'
Then dbo.fGetPropVal(p.Name,'LEN')
Else 0
End As 'LEN',
...
FROM Prod p
JOIN PCat pc
ON p.PCatID = pc.ID,
JOIN PType pt
ON pc.PTypeID = pt.ID
...
(udf - like...)
SELECT Value
FROM PropVal pv
JOIN Prop pr
ON pv.PropID = pr.ID
JOIN Prod p
ON pv.ProdID = p.ID
JOIN PCat pc
ON p.PCatID = pc.ID
JOIN PType pt
ON pc.PTypeID = pt.ID
WHERE p.Name = @PName
AND pr.Name = @PropName
Is there much I can do with this?
Any advice or pointers in the right direction will be most appreciated.
I don't speak Idiot - please talk slowly and clearly
|
|
|
|