|
First of all i´d like to say Hi to all the members of this forum, and say thanks to the webmasters of this page; it´s a great one
My problem is the following:
I started developing VB.NET App about 5 months ago, and i am very concerned about database performance, because the software I develope at my job mainly involves using them.
I´ve been working on a project for about 2 months that uses an access database shared on a network folder (yep, that sucks i know) and i´d really like that someone tell me about a webpage or a book from where i can gain some expertise about that.
Currently, my app does one operation where it has to make several select and update commands, making the process very slow... While making that, the form of the app stutters, tried to use application.doevents, but was not very effective... should it be wise to create a thread and complete the operation in that thread?
As you see, i´m very newbie to this, and i feel a little lost... Hope that someone can lead me hand. Thanks a lot for reading, and sorry about my english
|
|
|
|
|
i need to clear all connection to the mssql server database via t-sql(the action that we can do by enterprise manager). because i want to restore database, but when it has some connection , i cant do that in my application. my application works in network and in the restore time, other clients may have transaction(s) on database. sql server doesnt allow to a client to restore but the restoring client is admin AND he realize to restore in this time, however other clients are working with database at the same time.
Thanks
Rastegar
|
|
|
|
|
Try this
ALTER DATABASE DatabaseName WITH ROLLBACK IMMEDIATE RESTORE DATABASE
DatabaseName FROM DISK = 'C:\DatabaseBackup.bak'
The ALTER DATABASE command will automatically kill all connections to the database being restored. This command prevents the need to query master.dbo.sysprocesses to kill existing connections in order to complete the restore.
Alomgir Miah
Live Life King Size
|
|
|
|
|
im so sorry but your code in query analyzer make these errors:
Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'WITH'.
Server: Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'IMMEDIATE'.
could you please correct it and send me.
Thanks
Rastegar
|
|
|
|
|
Which version of SQL server you are using
Alomgir Miah
Live Life King Size
|
|
|
|
|
Restore an entire database:
RESTORE DATABASE { database_name | @database_name_var }
[ FROM < backup_device > [ ,...n ] ]
[ WITH
[ RESTRICTED_USER ]
[ [ , ] FILE = { file_number | @file_number } ]
[ [ , ] PASSWORD = { password | @password_variable } ]
[ [ , ] MEDIANAME = { media_name | @media_name_variable } ]
[ [ , ] MEDIAPASSWORD = { mediapassword | @mediapassword_variable } ]
[ [ , ] MOVE 'logical_file_name' TO 'operating_system_file_name' ]
[ ,...n ]
[ [ , ] KEEP_REPLICATION ]
[ [ , ] { NORECOVERY | RECOVERY | STANDBY = undo_file_name } ]
[ [ , ] { NOREWIND | REWIND } ]
[ [ , ] { NOUNLOAD | UNLOAD } ]
[ [ , ] REPLACE ]
[ [ , ] RESTART ]
[ [ , ] STATS [ = percentage ] ]
]
Live Life King Size
Alomgir Miah
|
|
|
|
|
mssql2000
Thanks
Rastegar
|
|
|
|
|
hey!nice to meet you,everyone.you can call me bill.can we make friends?
recently i posted a problem on the forum,but hasnot had an answer.could
you please help me?i'm worring about it.my question is:how to serialize
(save) object into SQL Server?for a instance:
<serializable()>_
public class employee
private _name as string
private _age as string
public property name() as string
get
return me._name
end get
set(byval value as string)
me._name=value
end set
end property
.........
maybe use DataSet as interface,but i failed.i think you are a
warmhearted man.please help me.thank you very very much.
good luck and make more money! bill(in Code Project's name is:maaaxwell)
|
|
|
|
|
maaaxwell wrote:
i think you are a warmhearted man
Some of us are warm hearted, and some of us are men. Not all are both, or even either
To serialise an object, you need to store it as a stream of bytes, so the first step is being able to convert an object to a byte stream. I'm pretty sure that's what serialising a class does anyhow. Basically the steps are:
1. convert object to bytes
2. store bytes in DB
3. get bytes back
4. convert bytes back into object.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hey!thanks for your reply!yeah,you are a warm hearted man
i know the four steps you wrote,but i havenot had any idea about how to serialize them into database(SQL Server),could you please write in detail?
thanks!
maaaxwell
|
|
|
|
|
I can't provide more detail because I have no idea what your objects are. What are you trying to store ?
Here[^] is an article on serializing classes. Once you have the ability to serialise to a stream, you can build a string to pass to the SQL, and use that string to deserialise.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
How can I create a DTS package dynamically? I want to transfer data from tables in sql server to an access database.
The access database already exists but not the tables. The tables in the access database need to be created on the fly because I don’t know what tables will be transferred.
Thanks,
Martin
|
|
|
|
|
Check here
"People who never make mistakes, never do anything."
My blog
http://toddsnotsoamazinglife.blogspot.com/
|
|
|
|
|
Hi,
I'm trying to get/set datetime field of exchange item (in resolution of Milliseconds) - using ADO.RecordClass.
However it seemed that after I call Record.Update (in set case) the datetime value is rounded in seconds resolution.
(i.e. trying to set 19:00:00.111 --> result with 19:00:01.000)
Please note - I'm using C# language to do so.
Can anyone help me to overcome this problem?
10x,
Zachi
|
|
|
|
|
I always use TimeSpan or DateTime as they have access to millisecond, please explain a little bit more why you are using ADO.RecordClass
Thanks
Al
|
|
|
|
|
Hi,
First, Thanks for your reply.
Here is the thing - I'm using ADO (as interop in c# project) to access exchange storage items.
When I tried to access record field of type 'datetime.tz' (using Record.Fields[<fieldname>].Value) either for reading or for writing - it seemed that ADO round DateTime fields with resolution of seconds (i.e. instead of getting '12:00:00.123' --> I'm getting '12:00:01').
Also, I'm using Exchange-Explorer tool to read/modify 'datetime.tz' field it succeed to do so (with resolution of milliseconds).
It is strange - but I checked retrieval using OLE-DB (not ADO) and it succeed to bring resolution of milliseconds (as should).
I will be more than grateful if you can help me with this one.
10x,
Zachi
|
|
|
|
|
I am using ADO classes but when I'm compiling my file im having linking errors that are:
--------------------Configuration: file_name - Win32 Debug--------------------
Compiling...
file_name.cpp
Linking...
file_name.obj : error LNK2001: unresolved external symbol "public: int __thiscall CADODatabase::Execute(char const *)" (?Execute@CADODatabase@@QAEHPBD@Z)
file_name.obj : error LNK2001: unresolved external symbol "public: int __thiscall CADODatabase::Open(char const *,char const *,char const *)" (?Open@CADODatabase@@QAEHPBD00@Z)
file_name.obj : error LNK2001: unresolved external symbol "public: void __thiscall CADODatabase::Close(void)" (?Close@CADODatabase@@QAEXXZ)
Debug/file_name.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
file_name.exe - 4 error(s), 0 warning(s)
I can't figure out what's the problem
Can you help me?
Thanks guys
Zvanolli
|
|
|
|
|
It seems that you must add to the project the files or the library where CADODatabase is defined.
Marc.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Hi,
I am writing a window desktop application which only
allow single user. Then is it necessary to have transaction
management for the data writing to the relational database ?
The data writing operation includes several steps (ie. if
the window hangs, then the operation may be corrupted).
Thanks
|
|
|
|
|
sure necessary especially if your writing operation has several steps.
think about if you get an error while inserting or deleting a record related to several tables. there would sure remain some unnecessary data in tables. (records that have been deleted or inserted before getting the error.)
|
|
|
|
|
Thanks for your reply.
But my program is not for enterprise application,
just for desktop single user. Is this still necessary coz
the addition of transaction into my program will cause a lot of effort ?
So are application like MSWord,...also adopts transactions ?
|
|
|
|
|
its up to you but if i were you i would use transaction. (depending uopn your words about the writing process)
anonymous wrote:
So are application like MSWord,...also adopts transactions ?
can you be more clear?
|
|
|
|
|
MSWord is not a database, so it neither supports not needs transactions. If you are making multiple related changes to multiple taples (for example: insert new row in main table, insert new row(s) in detail table using foreign key from new row in main table) you should always enclose these in a single transaction, so that if one of the dependant changes fails (an unexpected null value, an out of range value, etc. ) you can easily cancel the preceding changes (rollback the transaction). Adding the transaction support is relatively easy, and should not take much code,
Transactions really have nothing to do specifically with multi-user scenarios, instead the have to do with keeping changes consistent - preventing partial updates that could corrupt the data.
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
|
|
|
|
|
When creating table in access, the default item is not null.
How to create item which could be null?
Thanks!
|
|
|
|
|
Open the table in design view. Select the field in which you wish to allow nulls
set the "Required" entry to "no". If the field is a text or memo type, you may also want to set "allow zero length" to yes (this allows an empty string as a value, not the same as a null).
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
|
|
|
|