|
hi everyone , im using sqlite and i have a problem where, well i use a lot of delegates to make updates or inserts in the database and sometimes they collide and the database locks itself when writing is being done
i managed to "fix" this by using a lot of labels so everytime i get the exception "database is locked" i thread.currentThread.sleep, for 3 seconds and then my label sends it to the beginning of the try statement, kinda like this
retry:
try
{
}
catch
{
System.thread.currentThread.sleep(3000);
goto retry;
}
so with this i got it to work "kind of " simultanoulsy but i went here http://www.sqlite.org/faq.html[^]
and i see this sqlite3_busy_handler and SQLITE_BUSY stuff, i have read it like 100 times and still i dont have a clue how to use it or how to get it or anything about it, anyone of you can point me in the right direction?? appreciate the help
Im using c sharp application by the way
|
|
|
|
|
I think you could be able to get rid of the problem by changing the design a bit. For example if you would use a queue where db operation requests are put, you would never have collision if only one process reads the queue (kinda throttling).
However as a quick info, did you notice this: http://wangel.net/martin/codes/sqlite3.html[^]
|
|
|
|
|
hey man thanks , could you elaborate on this queue idea? that sounds like it could help
|
|
|
|
|
Did yo notice the post from Ennis. Compiling the SQLite with thread safety could solve your problem.
Anyhow, the queue idea is simply to use Queue..::.Synchronized Method[^]. Create a queue, put the statements from the delegates to it and dequeue at the other end using one worker thread. It was just a quick idea if you have to synchronize the operations manually. Another (easier?) way could be using lock[^].
|
|
|
|
|
Good thing the db connection will never go down. Looks like you have significant problems in your code and the least of which is SQL Lite locking. Item 6 in your link seems to give you your answer, however.
Need custom software developed? I do C# development and consulting all over the United States.
If you don't ask questions the answers won't stand in your way.
Doing a job is like selecting a mule, you can't choose just the front half xor the back half so when you ask me to do a job don't expect me to do it half-assed.
|
|
|
|
|
Hi ,
I want to retrive the xml data into my database table.
The xml file is from outside of application.so i want to retrive that xml data into database with in some temporary table
Thanq
|
|
|
|
|
see this
public void Import_Data(String XMLFILE_Parth)
{
con = new SqlConnection(StrconImport);
DataSet ds = new DataSet();
ds.ReadXml(XMLFILE_Parth);
SqlBulkCopy sbc = new SqlBulkCopy(con);
try
{
con.Open();
sbc.DestinationTableName = "dbo.XML_Resources_Import_temp";
sbc.WriteToServer(ds.Tables[0]);
}
catch (SqlException)
{
throw;
}
finally
{
if (con != null)
{
con.Close();
}
}
}
WOW simple neeeeeeeeeeee
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
You can use OPENROWSET[^] function. Something like:
SELECT *
FROM OPENROWSET(BULK 'path\file', SINGLE_BLOB) AS alias
You can place the result into a variable and then use CONVERT[^] to convert the data to XML (or you can do the convert in the select statement). After that you can insert the data into the table. If you want, you can compress this to one statement, but it will be harder to find errors if such occur.
INSERT INTO targetTable (targetColumn)
SELECT CONVERT(xml, alias.sourcecolumn)
FROM OPENROWSET(BULK 'path\file', SINGLE_BLOB) AS alias
|
|
|
|
|
hi,
i have a proble please help me
i hav a table which consists of userid and date
table1
userid startdate enddate
100 04/2/2009 04/30/2009
user 100 is under work from 2nd april to 30th april
if i try to give work from 04/10/2009 to 04/20/2009 to the user 100
now i should show that the user is already in work for given dates
how can I??
thanks in advance...
icanmakeiteasy
|
|
|
|
|
You can test the row and if the query returns a result they dates overlap. For example
select ...
from table1
where (startdate between convert(datetime, '04/10/2009', 101) and convert('04/20/2009', 101)
or enddate between convert(datetime, '04/10/2009', 101) and convert('04/20/2009', 101))
and userid = 100
However, use parameters instead of literals to define the start and end dates.
|
|
|
|
|
thx man
thank you very much
icanmakeiteasy
|
|
|
|
|
|
i tried to restore database in sql server 2005 for a .bak database given, in over normal way,but i could'nt. My client say that the .bak database was created in 2000.He tols to try with enterprise mgmt. I could'ne find that option in my sqlserver 2005.
How to solve this problem.
|
|
|
|
|
There should be no problems. Have you used RESTORE DATABASE ... WITH MOVE option? That way you're able to set a new location for the data files and the log files. The problem may be that you're trying to use the directory structure that was defined in the machine where the backup was taken.
aratireddy wrote: tols to try with enterprise mgmt. I could'ne find that option in my sqlserver 2005.
Didn't understand this. Do you mean you cannot find Management Studio. If that's the case, you propably haven't installed it. If you're using Express Edition, you have to download it separately from here: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796[^]
|
|
|
|
|
I did try restoring with object browser but not with query. plz give be query with options..
The client also told to first create the db by the same name and select overwrite option and then restore. But i could get the overwrite option
|
|
|
|
|
aratireddy wrote: plz give be query with options
Take a look at the doc: RESTORE[^] especially example D.
aratireddy wrote: The client also told to first create the db by the same name and select overwrite option and then restore. But i could get the overwrite option
Don't know what this means. The overwrite option is on the second page of the restore dialog (if I remember correctly). There you can also change the names and the paths of the files.
|
|
|
|
|
go to management studio .
create a database with .bak file name after creation of database rightclick on the database u will get tasks in that u will find restore option where u can restore the file
|
|
|
|
|
I'm trying to create a search stored proc with mysql.
the procedure uses roughly 7 parameters and depending upon the users choice of dropdownlists and datepickers i want to return the results.
for instance:
2 dropdowns with ID so that user can select WHERE ID > Parameter_ID
WHERE ID < Parameter_ID
has anyone attempted something similiar and if so could they point me in a good directly for some resources.
|
|
|
|
|
where (param1 is null OR param1 > someColumn)
AND (param2 is null OR param2 = someColumn
etc, its ugly but does work.
Need custom software developed? I do C# development and consulting all over the United States.
If you don't ask questions the answers won't stand in your way.
Doing a job is like selecting a mule, you can't choose just the front half xor the back half so when you ask me to do a job don't expect me to do it half-assed.
|
|
|
|
|
Ennis reply is the correct method, however be careful with this one, string too may together, and 7 is too many, and it can grind your query to a halt.
Best bet is to try and force some required filters and apply them first depending on your data size. I have even gone down the path of using a case statement to get the first valid filter, drop the results into a temp table and apply a secondary set of filters to the temp table to improve performance.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
Hello,
I have asp.net webpage with ReportViewer control on it. I would like to maintain log for every export that occurs. Unfortunately there is no reportexport event for the web based report viewer (for windows control there is). Is there any way to log exports? Does report services maintain some internal log itself?
Thanks.
|
|
|
|
|
However, from my experience in Crystal you can disable certain buttons, including the export button. Then provide duplicate functionality of your own button. You would then be able to track the export.
Need custom software developed? I do C# development and consulting all over the United States.
If you don't ask questions the answers won't stand in your way.
Doing a job is like selecting a mule, you can't choose just the front half xor the back half so when you ask me to do a job don't expect me to do it half-assed.
|
|
|
|
|
That's an option but I was hoping for an easier/nicer solution.
|
|
|
|
|
Giorgi Dalakishvili wrote: easier/nicer solution.
You are using Crystal rght - not gonna happen. The reason we moved from CR was that it is a closed shop, you cannot extend it in any way.
Never underestimate the power of human stupidity
RAH
|
|
|
|