|
dikshant@p-dd.com wrote: but i want it to be implemented using multithreading..
So what is the problem ? You can use BackGroundWorker class for doing this. It provides various functionalities for implementing threading.
|
|
|
|
|
I used the following code as you suggested and I still get the error:
"Object reference not set to an instance of an object".
public class DataSetsCS
{
public DataSet_MI[][] dsMI;
public DataSetsCS()
{
this.dsMI = new DataSet_MI[10][];
for (int i = 0; i <= 10; i++)
{
for (int j = 0; j <= 1; j++)
{
this.dsMI[i][j] = new DataSet_MI(); *****error here****
}
}
}
}
Thanks for the help,
Michael
|
|
|
|
|
Just add following line before the second for loop
dsMI[i] = new DataSet_MI[2]; // 2 because secod loop has j<=1
I hope it helps.
Until you realize this message has nothing to say, its too late to stop reading
|
|
|
|
|
I trie using the following and got the error:
this.dsMI[i][j] = new DataSet_MI[10][];
Cannot implicitly convert type 'DataSet_MI[][]' to 'DataSet_MI'.
Also I do need the second dimension there, I don't remember why but I ran into that a few days back.
modified on Wednesday, December 05, 2007 4:00:45 AM
|
|
|
|
|
MAW30 wrote: this.dsMI[i][j] = new DataSet_MI(); *****error here****
I don't know what was there in your last message, But you should look into the usage of a jagged array.
this.dsMI[i][j] = new DataSet_MI[rowsSize]; . Hope that makes sense, problem was your array location was not instantiated. So you need to specify how much space it can occupy, then add your dataset instance over there. Check this[^] for a good jagged array example.
|
|
|
|
|
I get the error message "Cannot implicitly convert Dataset_MI to DataSet_MI[].
|
|
|
|
|
Can you show how you are doing this ?
|
|
|
|
|
I did it just as you suggested. See the following:
public class DataSetsCS
{
// DataSets
public DataSet_MI[][] dsMI;
public DataSetsCS()
{
this.dsMI = new DataSet_MI[10][];
// dsMI
for (int i = 0; i <= 10; i++)
{
for (int j = 0; j <= 1; j++)
{
this.dsMI[i][j] = new DataSet_MI[15000];
}
}
}
}
|
|
|
|
|
MAW30 wrote: this.dsMI[i][j] = new DataSet_MI(); *****error here****
You would get this error because you have declared the dataset as a two dimensional array and then are initialising it as a simple object. I have to wonder what you are actually trying to accomplish because this seems to be attempting to create arrays of datasets which is not what I would expect you want.
I think you are probably trying to initialise the rows and columns inside the dataset. I suspect what you are trying to do is add the rows and columns inside the dataset. Is this correct?
|
|
|
|
|
Yes I know it should have been 2 dimensions. I also tried that but stillget a similar answer.
The original problem began when I was able to load up a single dimension dataset but could not do the same with multidimensions. I was the told I need to instantiate the arrays. So I have been trying peoples suggestions but nothing seems to work.
Michael
|
|
|
|
|
Did you tried this code??
public class DataSetsCS
{
public DataSet_MI[][] dsMI;
public DataSetsCS()
{
this.dsMI = new DataSet_MI[10][];
for (int i = 0; i <= 10; i++)
{
this.dsMI[i] = new DataSet_MI[2];
for (int j = 0; j <= 1; j++)
{
this.dsMI[i][j] = new DataSet_MI(); *****error here****
}
}
}
}
In case of your code, when you will execute
this.dsMI[i][j] = new DataSet_MI();
the value of this.dsMI[i] will be null and hence the exception.
Until you realize this message has nothing to say, its too late to stop reading
|
|
|
|
|
Earlier I didnot understand what you meant, now I understand I will work on it.
I get the following error message:
Index was outside the bounds of the array.
|
|
|
|
|
I got it to work thanks,
Michael
|
|
|
|
|
Make sure the size of dsMI[i] is one more than the value after "j <= " in for statement.Also if you are using "<" instead of "<=" put size equal to the value after "<".Check following lines, it will make it clear:
dsMI[i] = new DataSet_MI[size]; // if you use j < size
and
dsMI[i] = new DataSet_MI[size + 1]; // if you use j <= size
Until you realize this message has nothing to say, its too late to stop reading
|
|
|
|
|
hi .i have problem connecting the database to the textbox
SqlConnection cnn = new SqlConnection("server=(local); database=pubs;Integrated Security=SSPI");
SqlDataAdapter da = new SqlDataAdapter("select * from authors", cnn);
DataSet ds = new DataSet();
da.Fill(ds);
if i settle the connection above..
how do i connect the data from table authors e.g. 'name' to the textbox..
this.textbox.text = ???????
|
|
|
|
|
this.textbox.text = ds.DataTable[0].Rows[0]["name"].ToString();
|
|
|
|
|
|
datatable's function is to get one record ..
DataTable table999;
string command = "select * from Table1";
SqlDataAdapter father = new SqlDataAdapter(command, myConnection);
DataSet son = new DataSet();
father.Fill(son,"Table1");
table999 = son.Tables["Table1"];
this.aaa.Text= table999.Rows[0]["name"].ToString();
it said tat the father.fill(son,"Table1") got problem
|
|
|
|
|
Because the table name is the one you added in the dataset:
DataTable table999;
string command = "select * from Table1";
SqlDataAdapter father = new SqlDataAdapter(command, myConnection);
DataSet son = new DataSet();
son.Tables.Add("Table1");
father.Fill(son, "Table1");
...
That's work.
But there has only one select statement in your case, why don't you use the index rather than table name?
|
|
|
|
|
how to do that in index? can u pls kindly show your code. thanks
|
|
|
|
|
As I posted before:
this.textbox.text = ds.DataTable[0].Rows[0]["name"].ToString();
|
|
|
|
|
i have to export the data present in a datagridview to excel. Does anyone know how to do it. this is windows application using c#
|
|
|
|
|
|
Hi,
i have a user control windows form.where i use splitter control.
and i drag this user control on another form. i want scrolling on
my user control.for which i have use used splitter control.but
splitter control,do not shows scrolling (splitter control panel2)
so how can i show scrolling in user control, when i drag it in to another form.
amit
|
|
|
|
|
you want to scroll bar show in the panel or your user control??
|
|
|
|