|
Hello friends!!
I observe that sometimes my queries took 2 0r 3 sec and sometimes it took 1.30 min or 2 mins
that might be problem due to some other user access same table or view??
already i optimised my query but still it took sometimes little bit long time!
if soem other user access the same table then is there any process to lock the table or waiting option ????
please help me out!!!
T.I.A
Shashank
|
|
|
|
|
if another user opens the table for exclusive use before you do, it will be locked until he closes it. IIRC The default locking scheme depends on the version of access in use, and connection string defaults' Some can be modified by the connection string or connection properties see this[^] for more information
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
The opposite of the religious fanatic is not the fanatical atheist but the gentle cynic who cares not whether there is a god or not.
Eric Hoffer
|
|
|
|
|
Hi everyone
Is there a quicker and more efficient way of importing data programmatically from a table in database A into a table in database B using a C# windows application?
At the moment I open the connection to database A and read the data form the table into a dataReader object. Then I open the connection to database B, loop through the datareader and insert the data into the table in database B.
Thanks.
Kobus
|
|
|
|
|
I am writing a C# windows app with a MS Access database.
What I would like is to have a query that will delete a specified number rows from the data table that match a criteria. Note I do not want to delete all the rows that match the criteria justa specified amount.
For example my table contains 50 rows of which 30 match the criteria but I want to delete 15 of them, any 15 will do.
|
|
|
|
|
Delete top 15 * from mytable where...
if there are fewer than 15 will delete them all.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
The opposite of the religious fanatic is not the fanatical atheist but the gentle cynic who cares not whether there is a god or not.
Eric Hoffer
|
|
|
|
|
Hi!
I'm facing an error when i'm testing my program. The error is: If i query, insert ... a big sum of data forward and backward from my SQL Server to my app continuous, a little later, my app can't do any query to SQL Server anymore (even a simplest query string : select * from ...).
I don't know why it is happened? Anyone can help me please! I'm too anxious! I don't want my app just can process with a little data
Thanks!
(I'm sorry if my English is too bad )
|
|
|
|
|
You didn't mention what language your application was written in.
Are you remembering to close your connection to the database when you are finished with it.
If you are using a .NET language such as C# or VB.NET are you callng Dispose on your connection object?
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
Yes, i did remember close the connection when i am finished but i don't understand the dispose() you recommended here. When i want to query or insert database, i often code it like this:
conn.open();
comm.ExecuteNonQuery();
conn.close();
Am i missing something ?
My application was written in C#.
Thanks your reply
|
|
|
|
|
|
I'll try it! Thanks!
|
|
|
|
|
I have a decimal value 23.25 . When i use the math.round(23.25,1) in VS.NET, the result is 23.2 but with the function: round(23.25,1) in SQL Server 2000, the result is 23.3
How can i let them return the same value ?
Thanks!
|
|
|
|
|
SQL and .Net use different rounding algorithms (as you have observed), ao the answer is that you can't. Net's version is the more 'proper' algorithm: it returns the nearest even number when the value is half way between (.25 will round to .2, .35 will round to .4) This yeilds more accurate averages and totals for the rounded data, and so is prefered. It is sometimes called "Banker's rounding". SQL always rounds to the next larger number for the mid value, which leads to totals and averages that are biased to the high side.
I would recommend choosing the rounding behavior that you prefer, and always doing the rounding that way (i.e. either have ONLY SQL do the rounding, or ONLY .Net). I suspect that returning unrounded values from SQL and doing the rounding in .Net would be marginally more performant.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
The opposite of the religious fanatic is not the fanatical atheist but the gentle cynic who cares not whether there is a god or not.
Eric Hoffer
|
|
|
|
|
I need help i am trying to creat a program in VB.net for a pda.
i already have the database created using the quary analizer.
but i can not get the connection to work.
Public Sub conn()
Dim conn As New SqlCeConnection
conn.ConnectionString = "Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0; Data Source=\My Documents\abook.sdf;"
end sub
but i keep getting exceptions
i have searched threw several examples but they all start out by creating the database or using XML.
all i want is to retrieve data and manipulate it.
please some one explane what i am doing wrong, and a good example of what i need to do.
|
|
|
|
|
what is the error being reported in the exception?
And don't you need some kind of authentication in the connection string?
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
The opposite of the religious fanatic is not the fanatical atheist but the gentle cynic who cares not whether there is a god or not.
Eric Hoffer
|
|
|
|
|
I've made a table in access with a columnfield "searchdate"
Now I want to filter rows between two dates in the columnfield "searchdate" using two datetimepickers. I'm using the (configure)oldedbadapter with the querybuilder with the following SQL-expression :SELECT...FROM...WHERE ([searchdate] >= ?) AND ([searchdate] <= ?)
My code : oledbdataAdapter.selectCommand.parameters("searchdate").value = datetimepicker1.value.date
oledbdataAdapter.selectCommand.parameters("searchdate").value = datetimepicker2.value.date
dataset.clear
oledbdataadapter.fill(dataset)
result: it doesn't work!!!
if I'm using the expression select....from...where ([searchdate] >= ?)and ([searchdate]<= #01/12/2005#)he finds the records beween a date chosen with the datetimpicker1 and the date 01/12/2005.
Can somebody help me how to find rows beween two dates using two datetimepickers bound two one columnfield "searchdate"
Thank you very much for answering to my question.
Boutie
|
|
|
|
|
You are giving both dates the same parameter name, so the result is that you are asking for all the records between the same dates: dateTimePicker2 is 5-9-2004 then the query becomes: select...from...where [searchdate] >= #05/09/2005# and [searchdate] <= #05/09/2005#
Instead of using the field name as a parameter name, use some arbitrary names like p1,p2 so each of the two parameters in your query have different names. add tem to the parameters collection and set their values in the order they will be used in the query (the oledb layer doesn't care about the parameter names, just the order; but the .Net collection object (the parameters collection of the query) wants unique parameter names)
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
The opposite of the religious fanatic is not the fanatical atheist but the gentle cynic who cares not whether there is a god or not.
Eric Hoffer
|
|
|
|
|
Hi all,
how can I get the new id after adding a new DatRow when I'm working with an (offline) Dataset. Which sql command is to use for ?
(or is there an other command ?)
I am working with
MissingSchemaAction.AddWithKey
("SELECT @@IDENTITY") is asking the (online) Database and not the Dataset, isn't it ?
thanks
regards
|
|
|
|
|
It's asking the database.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
The opposite of the religious fanatic is not the fanatical atheist but the gentle cynic who cares not whether there is a god or not.
Eric Hoffer
|
|
|
|
|
Thank you for this info,
but what's the way working with offline tables and getting the new id after adding a row?
regards
Frank
|
|
|
|
|
There is no way to get a new identity key when working offline. Only the server knows what its next identity will be.
It is best to rethink your design and use UniqueIdentifiers (GUIDs) in place of your identity keys. They can be developed on the client without clashing with keys on the server.
|
|
|
|
|
Hi Michael,
that's a good idea, and I will follow that way in the future. But I think I found a way for my problem but I'm not shure if it always works fine.
...
I placed an eventhandler in the data_new routinem like that:
Table.RowChanged += new DataRowChangeEventHandler(Table_RowChanged);
...
private void Table_RowChanged(object sender, DataRowChangeEventArgs e)
{
if(e.Action.ToString() == "Add")
{
Console.WriteLine("index1 = " + e.Row["id"].ToString());
}
}
// The dataset in the database is locked to prevent changes from other users.
Thank's
Frank
|
|
|
|
|
|
For an absolute beginner, the books online that come with SQL Server are pretty good, actually. However, I have The programmers guide to SQL and found it very helpful. Then I bought the guru's[^] guides, although I'm far from a guru, I at least have a good source of info when I need to pretend to be....
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
the books online that come with SQL Server are pretty good
I do not have SQL Server. I have played with MySQL, MSDE, Access, and SQLite, but I want to get beyond the basic playing and learn how to actually do something. Thanks for the link to the guru's books, looks like they would also make an interesting addition to my book shelf.
As an aside, the link you gave me to amazon.com lists it's prices in US dollars does it not? The price they are quoting for the box set is $98.86. I looked up the same box set on chapters.ca and they are quoting $97.99 CDN. With the exchange what it is I would save 20% by buying the set from chapters instead of from amazon. Not only that, but chapters gives free shipping.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
MSDE is Sql server. SQL Books On line can be downloaded here.[^]
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
The opposite of the religious fanatic is not the fanatical atheist but the gentle cynic who cares not whether there is a god or not.
Eric Hoffer
|
|
|
|