|
hi all
i want to show a column value from datatable.I tried as below . it doesnt shows the values.
pls help.
SqlDataAdapter adpt = new SqlDataAdapter(cmd);<br />
DataTable dtCust1 = new DataTable("CustomerDatTab");<br />
adpt.Fill(dtCust1);<br />
<br />
dataGridView1.DataSource=dtCust1;
<br />
<br />
DataRow dr = new DataRow();<br />
foreach (DataRow dr in dtCust1.Rows)<br />
comboBox1.Items.Add(dr.ToString());<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
thank u
senthil
|
|
|
|
|
kssknov wrote: i want to show a column value from datatable.I tried as below . it doesnt shows the values.
Yes, you can get values from your DataTable. You could get them from either the DataGridView, or from the DataTable itself I'm just going to show you how to get them from the DataTable. Lets say you want to get all values from a specific column, here's how you would do it:
for (int rowIndex = 0; rowIndex < yourDataSet.yourDataTable.Rows.Count; rowIndex ++)
{
for (int columnIndex = 0; columnIndex < yourDataSet.yourDataTable.Columns.Count; columnIndex ++)
{
Console.WriteLine(string.format("Row {0}, Column {1} cell value is {2} !", rowIndex.ToString(),
columnIndex.ToString(), yourDataSet.yourDataTable.Rows[rowIndex][columnIndex].ToString()));
}
}
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
As length property give complete number of elements in the array. But if only i want to know count of only not null values elements of the array what should be the method or property need to be used.
Thanks in Advance.
|
|
|
|
|
I don't think there's anything built in, so you'd probably have to iterate through the entire collection and keep a count yourself.
"On one of my cards it said I had to find temperatures lower than -8. The numbers I uncovered were -6 and -7 so I thought I had won, and so did the woman in the shop. But when she scanned the card the machine said I hadn't.
"I phoned Camelot and they fobbed me off with some story that -6 is higher - not lower - than -8 but I'm not having it."
-Tina Farrell, a 23 year old thicky from Levenshulme, Manchester.
|
|
|
|
|
Please redirect me to some working code in C#.NET to convert a word file into a PDF. I need it urgently....
Thanks in advance...
Vruddhi
|
|
|
|
|
If it's urgent, get out your credit card and google for a commercial product. If it's not that important, google for free code and take your chances.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Vruddhi Vasoo wrote: Please redirect me
Sure. It is a pleasure.
Response.Redirect("http://www.google.com/");
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Vasudevan Deepak K wrote: Sure. It is a pleasure.
Response.Redirect("http://www.google.com/");
You have learned well. The force is strong with you.
|
|
|
|
|
Vruddhi Vasoo wrote: Please redirect me to some working code
Why don't you do a little work yourself? Use google, MSDN, try to write at least a little code...
Vruddhi Vasoo wrote: I need it urgently....
I bet you do, but guess what? No one gives a flying rat's ass what you want or when you need it.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
|
This is after ages I may be adding a comment to the thread, but thought like sharing info I had on my exp.
There are no built in libraries in dot net to convert from word to PDF, in this context its a good practise to use third party's like Abcpdf.dll where you can even embed images with paging in generated pdf.you can further refer to "http://dotnetf1.blogspot.com/2008/07/convert-word-doc-into-pdf-using-c-code.html" for third parties which are available for free of cost.
modified on Wednesday, September 3, 2008 8:55 AM
|
|
|
|
|
Hi
I have a string called db1 which contains a code value
I need to set this string as a global session for the page.
What is the syntax for this, I have tried
Session["gdb1"] = db1;
however the session appears to be blank??
thanks in advance
|
|
|
|
|
Two thoughts.
1. Is db1 populated at this point? If it's null then the Session will still be empty.
2. Are you running a multi-core machine? If so, you can run into problems with state management if your state service is running "in process". To get round this, you need to run your session manager as either a Sql state service or ASP State Service.
Assuming that you want to run as the ASP.NET state service, if you look in your Services, you will see one of the services is called ASP.NET State Service. This needs to be running, and you must set your config file to run the sessionState as StateServer. Typically this would look something like
<sessionState mode="StateServer"
stateConnectionString="tcpip=dataserver:42424"
cookieless="false"
timeout="20"/>
|
|
|
|
|
thanks for the reply got it sorted now!
|
|
|
|
|
Jamie1985 wrote: I need to set this string as a global session for the page.
Session variables are not global, they are specific for the user.
If you want a global value, use an Application variable instead:
Application["gdb1"] = db1;
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
|
|
Could you describe exactly what the valid input is that you want in all it's different forms
i.e.
+27XXXXXXXXX where X is a number
or
0XXXXXXXXXXX where X is a number
or
+0XXXXXXXXXXX where X is a number
then also exactly describe what format you want the input to be saved in.
|
|
|
|
|
the users can type in
+27XXXXXXXXX where X is a number (it will be 12 charaters)
or
0XXXXXXXXX where X is a number (it will be 10 charaters)
it can be saved in either format. The main thing is that the +27 is optional and there should be no spaces.
J9
|
|
|
|
|
You will have two parts: the prefix (either +27 or 0) then the number (9 digits). The regex would be:
(?:\+27|0)\d{9}
The "?:" part, says that we do not want to capture the text matched by the "stuff" in the parenthesis into a separate group.
If you need to get each part separately, then you could group each part, like so:
(?<prefix>\+27|0)(?<number>\d{9})</number></prefix>
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
|
hi,
i m having a integer array which i need to sort frequently
example code:
int[] intarray = new intarray[5];
in between the code
array.sort(intarray);
now this code runs fine sometime and sometime it fails
error is
Failed to compare two elements in the array.
pla if anyone is having any idea abt this then plz do let me know
regards sindhu tiwari
its me sid
modified on Friday, January 04, 2008 3:26:44 AM
|
|
|
|
|
Array.Sort() fails for vanilla integer arrays? While it's possible, I think it's highly unlikely.
Have you googled for the exact exception message? I doubt if you've given the exact message, and Google returns no results.
Cheers,
Vikram.
"If a trend is truly global, then that trend ought to be visible across ANY subset of that data" - fat_boy
|
|
|
|
|
this is the error which i got "Failed to compare two elements in the array."
and searched on google too but unfortunately dint got proper result if u any way to sort or any idea then plz do let me now
sindhu tiwari
its me sid
|
|
|
|
|
Well, could you show us what values you've put in the array then?
|
|
|
|