|
Who, on this earth, is "ne1" and why have you directed your question specifically at this person??
(There'a hint buried in this post, if it wasn't obvious)
|
|
|
|
|
Dave Kreskowiak wrote: Who, on this earth,
with the advent of wireless internet, ne1 could be newhere...
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
|
I'm trying merge DataTable "db2_table1" into to DataTable "db1_table1". But it doen't seem to work. Any help will be appreciated....
<br />
public class MergeTableClass<br />
{<br />
private OleDbDataAdapter da1, da2;<br />
private DataSet ds1;<br />
<br />
public void MergeTables(string connS1, string connS2)<br />
{<br />
string connString1 = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + connS1;<br />
string connString2 = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + connS2;<br />
OleDbConnection oleConn1 = new OleDbConnection(connString1);<br />
OleDbConnection oleConn2 = new OleDbConnection(connString2);<br />
string cmd1 = "SELECT *FROM db1_table1";<br />
string cmd2 = "SELECT *FROM db2_table1";<br />
da1 = new OleDbDataAdapter(cmd1, oleConn1);<br />
da2 = new OleDbDataAdapter(cmd2, oleConn2);<br />
ds1 = new DataSet();<br />
<br />
da1.Fill(ds1,"db1_table1");<br />
da2.Fill(ds1,"db2_table1");<br />
<br />
ds1.Tables["db1_table1"].Merge(ds1.Tables["db2_table1"]);<br />
da1.Update(ds1,"db2_table1");<br />
ds1.AcceptChanges();<br />
<br />
}<br />
}<br />
|
|
|
|
|
I think you're calling Update() on "db2_table1." Should you be calling it on "db1_table1"?
Lester
http://www.lestersconyers.com
|
|
|
|
|
I have tried both...still doens't work.
|
|
|
|
|
Oh ok. I think you just need to create a new command object with an update command. Then set the UpdateCommand of the adapter equal to that command object.
Lester
http://www.lestersconyers.com
|
|
|
|
|
I tried to create a OleDbCommandBuilder but it still didn't work...
OleDbCommandBuilder cmdBld = new OleDbCommandBuilder(da1);
|
|
|
|
|
What did you do next?
da1.UpdateCommand = cmdBld.GetUpdateCommand();
?
Lester
http://www.lestersconyers.com
|
|
|
|
|
Nothing yet...
public void MergeTables(string connS1, string connS2)
{
string connString1 = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + connS1;
string connString2 = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + connS2;
OleDbConnection oleConn1 = new OleDbConnection(connString1);
OleDbConnection oleConn2 = new OleDbConnection(connString2);
string cmd1 = "SELECT *FROM db1_table1";
string cmd2 = "SELECT *FROM db2_table1";
da1 = new OleDbDataAdapter(cmd1, oleConn1);
da2 = new OleDbDataAdapter(cmd2, oleConn2);
ds1 = new DataSet();
da1.Fill(ds1, "db1_table1");
da2.Fill(ds1, "db2_table1");
ds1.Tables["db1_table1"].Merge(ds1.Tables["db2_table1"]);
OleDbCommandBuilder cmdBld = new OleDbCommandBuilder(da1);
da1.UpdateCommand = cmdBld.GetUpdateCommand();
@da1.Update(ds1, "db1_table1");
ds1.AcceptChanges();
}
|
|
|
|
|
Found it..
The problem was that after the Merge none of the rows in data table had the state RowState Changed or Added. The update methon had nothing to apply.
This peace of code made the whole class work as it should:
foreach (DataRow row in ds1.Tables["db2_table1"].Rows)<br />
row.SetAdded();
Thanks
|
|
|
|
|
hi
I am using a combobox to load items using datatable. i am using sqlserver2005.when i tried to load a count of 32500 rows in a combobox , my application hangs more than for 5 min.
Any body give me solution.
Below is my code:
<br />
private void _popItemCombo()
{<br />
clsGrpObj = new clsGroupManip();<br />
clsDataAccObj = new clsGloDataAcces();<br />
dtItem = new DataTable();
dtItem = clsGrpObj._selItem_Assembly();<br />
for (int i = 0; i < dtItem.Rows.Count - 1; i++)<br />
{<br />
string item = dtItem.Rows[i]["ItemCode"].ToString();<br />
cmbItemCode.Items.Add(item);
}<br />
<br />
}<br />
help me,
Thank u
kssk
|
|
|
|
|
You should use cmbItemCode.DateSource = dtItem and set the DisplayMember and ValueMember instead.
Any auto search on the combobox? I would have to scroll 30000 rows on 8 items drop down to select a customer....
|
|
|
|
|
hi darkelv
just i tried that , it also takes exactly 6 seconds. If i ignore that
i am experiencing the same trouble in DataGridview combobox column. Can u tell me how to overcome that .
Thank u for ur quick response
kssk
senthil
|
|
|
|
|
Loading 30,000 items into a combo box is plainly not the right thing to do. A combo box is used to select from, with this many items it will be, to all intents, unusable.
You need to rethink what you are trying to achieve. Can you filter your list in some way?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Like Ashfield said, there's no way around it. You just have to load less data. The problem will be worse if you do it in the DataGridViewComboboxColumn.
You can subclass the combobox, let use enter the beginning letter of the item, and handle the text change or something. Once the control detected that use entered something, populate the combobox with the data beginning with the letter user entered, etc.
Or use a picker dialog.
|
|
|
|
|
I have a table and I want to store the whole database into a string array..
How do I do it?
Say I have a table with 10 fields and suppose the table contains 1000 entries.
I want to store each value of a field delimited by a character '|' and so there should be 1000 entries like this in the string array..
Som
|
|
|
|
|
make a loop that will read all rows and write in a string variable, you can also use string.Join() for this purpose
eg.
string line="";
for(int a = 0;a< DT.Rows.Count;a++)
{
string[] row = DT.Rows[a].ItemsArray;
line += string.Join("|", row) +"\n";
}
code is not tested, hope it will help
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
What is DT here..
Cant we use a SQL query to query the whole table from the database and then build up the string array?
If this is possible then please advice on this logic..
Som
|
|
|
|
|
DT is DataTable, assign a SQLDataReader to DataTable, it will read all the data from sql table or use DataSet
for more info use google
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hello friends i am developing an application in which there is printing option...
The printing option is working well but the problem is when the printdialog shows and by default the numbers of copies is 1 and if i increase the numbers of copies 2 or 3 then its only print one copy only why number of copies option is not working....
CODE
int count = Application.OpenForms.Count;<br />
for (int i = 1; i < count; i++)<br />
{<br />
PrintDialog myPrintDialog = new PrintDialog();<br />
memoryImage = new System.Drawing.Bitmap(panel1.Width, panel1.Height);<br />
panel1.DrawToBitmap(memoryImage, panel1.ClientRectangle);<br />
if (myPrintDialog.ShowDialog() == DialogResult.OK)<br />
{ <br />
myPrintDialog.Document = printDocument1; <br />
printDocument1.PrintController = new StandardPrintController();<br />
printDocument1.Print();<br />
}<br />
printDocument1.Dispose();<br />
}
|
|
|
|
|
this function will not work automatically, you have to do this dynamtically...
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
so how can i do this dynamically...............
|
|
|
|
|
put a int to count, call the PrintDocument_Print() event until you counter reach to 0. Do this work when your all pages finished, or if you do not want Collate, then call and decrease counter on every print but this time you will need to set again the actual value to counter
hope it will help
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
How do you add two hex values in c# to give a resulting hex value?
|
|
|
|