|
thanks a lot mika ..
i will try for it ...
|
|
|
|
|
You're welcome
|
|
|
|
|
HI Mika
i tried to run the procedure using the backgroundworking class. but for time being instead of oracle procedure for testing i have just used simple select statments.
i am just pasting here the code
System.ComponentModel.BackgroundWorker worker = new System.ComponentModel.BackgroundWorker();
private static string ConnectString = "connectionstring";// this is not the actual connection
DataSet ds = new DataSet();
DataSet ds2 = new DataSet();
DataSet ds3 = new DataSet();
private void button1_Click(object sender, EventArgs e)
{
worker.DoWork += new System.ComponentModel.DoWorkEventHandler(SomeLongRunningTask);
worker.RunWorkerAsync();
OracleConnection con = new OracleConnection(ConnectString);
OracleCommand command = new OracleCommand(" select * from CIHOLDDETAILS", con);
OracleDataAdapter da = new OracleDataAdapter(command);
da.Fill(ds);
}
// private delegate void DoWorkDelegate();
private void SomeLongRunningTask(object sender, System.ComponentModel.DoWorkEventArgs e)
{
//using (OracleConnection cn = new OracleConnection(ConnectString))
//{
OracleConnection cn = new OracleConnection(ConnectString);
OracleCommand cmd = new OracleCommand(" select * from CIINSPECTIONREPORTS", cn);
OracleDataAdapter orda = new OracleDataAdapter(cmd);
orda.Fill(ds2);
// DoWorkDelegate worker2 = new DoWorkDelegate(loaddata);
//}
}
private void worker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventHandler e)
{
loaddata();
}
private void loaddata()
{
DataTable dt = new DataTable();
DataTable dt2 = new DataTable();
dt = ds.Tables[0].Copy();
dt2 = ds2.Tables[0].Copy();
ds3.Tables.Add(dt);
ds3.Tables.Add(dt2);
dataGridView1.DataSource = ds3;
}
here RunWorkerCompleted is not firing i have done this code using this link
http://www.knowdotnet.com/articles/backgroundworker.html
please help me whats the problem here.
thanx in advance
modified on Friday, January 16, 2009 4:29 AM
|
|
|
|
|
As far as I can see you haven't wired the event. Try adding the following to the button click before you call RunWorkerAsync :
worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
|
|
|
|
|
|
Does anyone know of a good tool to generate database documentation from database schemas and extended properties for SQL Server? I have been looking at DBDesc http://www.dbdesc.com. Any other suggestions?
|
|
|
|
|
|
How do I convert an MsAccess Database into a MySQL Database and is their a free Utility to do so?
|
|
|
|
|
A quick internet search threw up this[^]
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I did exactly this and made the new database follow standards closer then it did in access however I wrote a conversion program without about 10,000 lines of code.
I would think that you could use a utility like this but you might not get the end result that you are looking for.
Humble Programmer
|
|
|
|
|
Hi,
I am having a problem with the below statements
when I give as below I am not getting any records.
declare @list char(100)
set @list = '''wc1'',''wc2'''
select * from iv30300 where trxloctn in (@list)
When I directly give the list I am getting the result.
declare @list char(100)
set @list = '''wc1'',''wc2'''
select * from iv30300 where trxloctn in ('wc1','wc2')
I am working on sql server 2005 version.
I am not able to find out the error.
|
|
|
|
|
AFAIK you cannot use variable to define an in-list with comma separated values. The contents of the variable is interpreted as a single value, not a value list.
Also you wouldn't need the quotation marks inside the string.
For example the following would work:
declare @value1 varchar(100)
declare @value2 varchar(100)
set @value1 = 'wc1'
set @value2 = 'wc2'
select * from iv30300 where trxloctn in (@value1, @value2)
Perhaps you could modify the in-list to a subquery.
|
|
|
|
|
There's an not error, you just can't do it the first way, the in clause doesn't take a variable like that.
|
|
|
|
|
Use XML
DECLARE @CSV XML
SET @CSV = '<key><id>1</id><id>2</id><id>3</id></key>'
SELECT
ParamValues.id.value('.','VARCHAR(100)')
FROM
@CSV.nodes('/key/id') AS ParamValues(id)
Run that and you should get three rows with values 1,2 & 3.
Join that to your query or use in the WHERE clause
Don't forget to parse the XML before presenting it to SQL in case there are any nasties on the input
|
|
|
|
|
Put the values into a table variable and join to it; in our projects we have a udf that parses a comma-separated string and returns a table variable of the data, it's not too hard to make one. Do that and then join to the table variable.
Keep It Simple Stupid! (KISS)
|
|
|
|
|
Hi ,
I need to create a tool to copy SQl server database into a mysql database.Could you please help me to get an idea of this ?.Do I need to use transaction?.How to avoid foreigh key conflicts ?
with warm regards.
|
|
|
|
|
Have you checked this article Migrating from Microsoft SQL Server and Access to MySQL[^].
Denver Thomas wrote: Could you please help me to get an idea of this
If you want to create a tool, one way is that:
- you get the schema information from MSSQL and create ddl scripts using MySQL syntax (or execute ddl against MySQL)
- you dump the data from MSSQL and import it to MySQL
If you need, there are several tools to use. For example, you can use SSIS in MSSQL and transfer data with it also bcp can be used to dump the data in MSSQL. Or you can do everything in code (depending on your needs).
Denver Thomas wrote: Do I need to use transaction
Well, since this is a conversion tool it's not necessary since you can always start again from the 'beginning'. Just take care that you don't have to do everything again. For example, if you have imported data to 100 tables and then table 101 fails, you just delete that table's contents and start loading it again.
Denver Thomas wrote: How to avoid foreigh key conflicts
First load data and after that create foreign keys.
|
|
|
|
|
Hi!
I want to open an older Microsoft Access 2.0 database VC++ 6 and MFC.
I've tried with both CDatabase and CDaoDatabase, but I get the same result
with both. It's says that I don't have read access to the table.
The database is orginally accessed from an VB3 application. Yes, it's an old program.
Example,
CDaoDatabase * pDb = new CDaoDatabase();
pDb->Open(db);
CDaoRecordset * pRs = new CDaoRecordset(pDb);
CDaoTableDef * pTd = new CDaoTableDef(pDb);
pTd->Open("MSysObjects");
pRs->Open(pTd, dbOpenSnapshot);
pDb->Close();
pRs->Close();
pTd->Close();
delete pDb;
delete pRs;
delete pTd;
The database is not password protected, and I get the same message with none sys tables.
Regards,
Linus
|
|
|
|
|
I have an ad-hoc report, which has a few functions. When I try to export the output of this report to a CSV file, it just exports an empty file. The value of the property DataElementOutput is set to "Output". But this does not seem to work. Changing the value of this property works for my other reports which do not involve anything ad-hoc. Any tips would help a lot.
Thanks in advance
Akila
|
|
|
|
|
I've had this happen if the report is too complex; for example, with graphs or perhaps some complex groupings.
Keep It Simple Stupid! (KISS)
|
|
|
|
|
Hi,
kindly let me know, How to drop/delete constraints using Oracle sqlplus?
thanx in advance
(Riaz)
|
|
|
|
|
What kind of constraint do you want to drop?
For example, if you want to drop check constraint on a column, you first find it's name in system tables (for example in ALL_CONSTRAINTS) and then use ALTER TABLE command to drop the constraint.
|
|
|
|
|
Hi. Is it possible to reset the autonumber of a ID in MS SQL Server?
Regards,
Matjaž
|
|
|
|
|
OK, found it on Google.
I had to run a query "DBCC CHECKIDENT (yourtable, reseed, 34)". Got it off of a . Pinal Dave blog
Regards,
Matjaž
|
|
|
|
|
I'm connecting to SQL Server 2005 Express Edition using C++/CLI.
Here's my code, actually from the book I'm following
#include "stdafx.h"
using namespace System;
using namespace System::Data;
using namespace System::Data::SqlClient;
void main()
{
SqlConnection^ connection = gcnew SqlConnection();
#ifdef SQLAuth
connection->ConnectionString =
"User ID=sa; Password=;"
"Data Source=(local); Initial Catalog=DCV_DB;";
#else
connection->ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\DCV_DB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
#endif
try
{
connection->Open();
Console::WriteLine("We got a connection!");
}
catch (SqlException ^e)
{
Console::WriteLine("No connection the following error occurred: {0}",
e->Message);
}
finally
{
connection->Close();
Console::WriteLine("The connection to the database has been closed");
}
}
I copied the connection string from the connection string property when you select the database connection in the Server Explorer in Visual Studio 2005.
And when I execute this i get the following error (exception thrown)
<br />
An error has occured while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error 40: - Could not open a connection to SQL Server)
Sorry for the too wide post
|
|
|
|