Click here to Skip to main content
16,012,759 members
Home / Discussions / Database
   

Database

 
GeneralRe: Stored procedure / query optimization Pin
Colin Angus Mackay29-Sep-04 13:24
Colin Angus Mackay29-Sep-04 13:24 
GeneralRe: Stored procedure / query optimization Pin
Bill Dean30-Sep-04 2:21
Bill Dean30-Sep-04 2:21 
GeneralRe: Stored procedure / query optimization Pin
Jeremy Oldham29-Sep-04 13:50
Jeremy Oldham29-Sep-04 13:50 
GeneralRe: Stored procedure / query optimization Pin
Vagif Abilov29-Sep-04 19:40
professionalVagif Abilov29-Sep-04 19:40 
Generaleqivalent of "FOR UPDATE" Pin
WinDotNet27-Sep-04 19:35
WinDotNet27-Sep-04 19:35 
GeneralRe: eqivalent of "FOR UPDATE" Pin
Anonymous30-Sep-04 0:34
Anonymous30-Sep-04 0:34 
GeneralOracleClient StoredProcedure Pin
jzb27-Sep-04 17:01
jzb27-Sep-04 17:01 
QuestionAny way to optomize this? Pin
Jacob Hammack27-Sep-04 16:48
Jacob Hammack27-Sep-04 16:48 
public DataSet GetEntries()
{
//top 5

string ConnectionString = ConfigurationSettings.AppSettings.Get("connString");

SqlConnection SQLConnection = new SqlConnection(ConnectionString);

string SQLView = "CREATE VIEW Content_View AS "
+ "SELECT TOP 10000 [HJ_BLog].* "
+ "FROM [HJ_BLog] "
+ "ORDER BY Date DESC ";

SqlCommand SQLCommandCreateView = new SqlCommand(SQLView, SQLConnection);

SqlDataAdapter DataAdapter = new SqlDataAdapter(SQLCommandCreateView);
DataSet UserSet = new DataSet();
DataAdapter.Fill(UserSet);
SQLCommandCreateView.Connection.Close();

string SQLQueryTop2 = "SELECT TOP 5 [Content_View].* "
+ "FROM [Content_View] ";

SqlCommand SQLCommandTop2 = new SqlCommand(SQLQueryTop2,SQLConnection);
SqlDataAdapter DataAdapterTop2 = new SqlDataAdapter(SQLCommandTop2);
DataSet UserSetTop2 = new DataSet();
DataAdapterTop2.Fill(UserSetTop2);
SQLCommandTop2.Connection.Close();


string SQLDropView = "DROP VIEW Content_View ";

SqlCommand SqlDropView = new SqlCommand(SQLDropView,SQLConnection);

SqlDropView.Connection.Open();
SqlDropView.ExecuteNonQuery();
SqlDropView.Connection.Close();


return UserSetTop2;

}

Pretty much using a view to sort then getting the top 5 from the view then deleting the view. Is there an easier way to do this? I am not sure the preformence hits on creating and droping views. or just a all around easier way to do this.

thanks
any points will be great
AnswerRe: Any way to optomize this? Pin
Mike Ellison27-Sep-04 17:15
Mike Ellison27-Sep-04 17:15 
GeneralRe: Any way to optomize this? Pin
Jacob Hammack29-Sep-04 11:39
Jacob Hammack29-Sep-04 11:39 
AnswerRe: Any way to optomize this? Pin
Bill Dean29-Sep-04 6:50
Bill Dean29-Sep-04 6:50 
QuestionHow to position to row in DataTable or DataView Pin
magic4927-Sep-04 7:58
magic4927-Sep-04 7:58 
AnswerRe: How to position to row in DataTable or DataView Pin
Bill Dean29-Sep-04 7:01
Bill Dean29-Sep-04 7:01 
Generalsaving/retrieving image data in MSDE Pin
LongRange.Shooter27-Sep-04 7:40
LongRange.Shooter27-Sep-04 7:40 
GeneralPartial answer Pin
Steven Campbell27-Sep-04 8:30
Steven Campbell27-Sep-04 8:30 
GeneralRe: urgent can any help me ? Pin
Mike Ellison27-Sep-04 18:26
Mike Ellison27-Sep-04 18:26 
GeneralRe: urgent can any help me ? Pin
Colin Angus Mackay29-Sep-04 7:02
Colin Angus Mackay29-Sep-04 7:02 
GeneralRe: urgent can any help me ? Pin
Mike Ellison29-Sep-04 7:10
Mike Ellison29-Sep-04 7:10 
Generaldatabinding a dataset / datarows / columns to a tablecontrol - please help Pin
sean123027-Sep-04 3:40
sean123027-Sep-04 3:40 
GeneralSQL server/ ADO.NET performance Pin
Paul Horstink27-Sep-04 0:47
Paul Horstink27-Sep-04 0:47 
GeneralRe: SQL server/ ADO.NET performance Pin
David Salter27-Sep-04 3:21
David Salter27-Sep-04 3:21 
Generalrow locking Pin
WinDotNet26-Sep-04 20:29
WinDotNet26-Sep-04 20:29 
GeneralParameterised Queries in VB6 Pin
David Wengier26-Sep-04 14:29
David Wengier26-Sep-04 14:29 
GeneralRe: Parameterised Queries in VB6 Pin
rmacfadyen26-Sep-04 15:10
rmacfadyen26-Sep-04 15:10 
GeneralRe: Parameterised Queries in VB6 Pin
David Wengier26-Sep-04 18:21
David Wengier26-Sep-04 18:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.