|
how can we fech data in an string array directly from dataset
dataset --> dataset11
table --> searchOnline
column --> url
string[] --> urlString
i want to directly get all the rows in column url came into the urlString
thanks
|
|
|
|
|
i tried this but it wont helped
<br />
url = new string[(dataSet11.SearchOnline.urlColumn.ExtendedProperties.Count)];<br />
dataSet11.SearchOnline.urlColumn.ExtendedProperties.CopyTo(url, 0);<br />
|
|
|
|
|
<br />
url = new string[dataSet11.SearchOnline.Rows.Count];<br />
name = new string[dataSet11.SearchOnline.Rows.Count];<br />
for (int i = 0; i < dataSet11.SearchOnline.Rows.Count ; i++)<br />
{<br />
name[i] = dataSet11.SearchOnline.Rows[i]["name"].ToString();<br />
url[i] = dataSet11.SearchOnline.Rows[i]["url"].ToString();<br />
}<br />
if i write the code as above
name and url array contains same data of url Column
else
if i write it like this then they both contains data from name column
<br />
url = new string[dataSet11.SearchOnline.Rows.Count];<br />
name = new string[dataSet11.SearchOnline.Rows.Count];<br />
for (int i = 0; i < dataSet11.SearchOnline.Rows.Count ; i++)<br />
{<br />
url[i] = dataSet11.SearchOnline.Rows[i]["url"].ToString();<br />
name[i] = dataSet11.SearchOnline.Rows[i]["name"].ToString();<br />
}<br />
please help me it is a true bug or its my mistake ???
|
|
|
|
|
<br />
url = new string[dataSet11.SearchOnline.Rows.Count];<br />
name = new string[dataSet11.SearchOnline.Rows.Count];<br />
for (int i = 0; i < dataSet11.SearchOnline.Rows.Count ; i++)<br />
{<br />
name[i] = dataSet11.SearchOnline.Rows[i]["name"].ToString();<br />
}<br />
for (int i = 0; i < dataSet11.SearchOnline.Rows.Count; i++)<br />
{<br />
url[i] = dataSet11.SearchOnline.Rows[i]["url"].ToString();<br />
}<br />
this solved the problem
but will you please tell me what is the concept behind this
|
|
|
|
|
I have posted my broblem in several place.. No replys that fixed anything.
I am not sure how this began BUT I have it on several computers I have. Three running XP home, One XP Media, and One running Linux and XP Pro (which crashed!) so it is sitting in the corner! My only thought is I have a bluetooth dongle from LINK-SYSTEMS (not blaiming them) A DBT-120 that loaded a Toshiba stack. Nothing wrong with it but I wanted to use the the Microsoft stack.
Anyway, ..
Using
// Reference registry hive.
Microsoft.Win32.RegistryKey hklm = Microsoft.Win32.Registry.LocalMachine;
Microsoft.Win32.RegistryKey myportsregKey = hklm.CreateSubKey("Hardware\\Devicemap\\Serialcomm\\");
Used to return my bluetooth port COM: ports. The string returns a garbage character at the end of the COM?? string.
I'm using something like
//Display value names found in registry
foreach (String valueName in myportsregKey.GetValueNames())
{
String toport;
//////////////////////////////
// THIS string is returned OK
toport = valueName;
toport += " .. "; // just a separator
// Display ports data found in resistry
// Note that I have seen the extra character as a number.
// Example" PORT8 will display as PORT81.. Or some strange character
// It really screws you up trying to open port 81 when it's really port 8!
// String for my bluetooth ports are returned corrupted
toport += myportsregKey.GetValue(valueName);
portList.Items.Add(toport);
}
YES! I KNOW YOU FOLKS CAN DO BETTER! NOT ME!
Anyway, if I use regedit I can type anything I want into the REG_SZ and it will return as I typed it. BUT, if I reboot and try this I get the extra character after the COMM port.
I assume the registry is written to updating the serial ports.
I WOULD SURE LIKE TO SOLVE THIS.
Reinstalling everything on my computers IS NOT A OPTION!
|
|
|
|
|
Hi guys, i'm executing a console application using :
<br />
Process prsAlgorithm = new Process();<br />
<br />
prsAlgorithm.StartInfo.WindowStyle = ProcessWindowStyle.Normal;<br />
prsAlgorithm.StartInfo.FileName = "Lottery.exe";<br />
prsAlgorithm.StartInfo.UseShellExecute = false;<br />
prsAlgorithm.StartInfo.RedirectStandardInput = true;<br />
prsAlgorithm.StartInfo.RedirectStandardOutput = true;<br />
<br />
prsAlgorithm.Start();<br />
<br />
System.IO.StreamWriter swWriter = prsAlgorithm.StandardInput;<br />
<br />
System.IO.StreamReader srReader = prsAlgorithm.StandardOutput;<br />
<br />
swWriter.WriteLine(m_strArgList);<br />
<br />
swWriter.Close();<br />
<br />
<br />
<br />
prsAlgorithm.WaitForExit();<br />
i need to redirect the output of this console application to a textbox on a window form,
but the problem is that i want that every line written in the console application, would be automaticaly written to the textbox (and not wait until the console application has exited)...
i'm pretty sure it has something to do with asynchronousy reading a stream or something like that...?
any suggestions?
Thanks in advance,
Erik.
|
|
|
|
|
....
System.Diagnostics.Process pr = new System.Diagnostics.Process();
pr.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
pr.StartInfo.FileName = "cmd.exe";
pr.StartInfo.UseShellExecute = false;
pr.StartInfo.RedirectStandardInput = true;
pr.StartInfo.RedirectStandardOutput = true;
pr.Start();
pr.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(pr_OutputDataReceived);
pr.BeginOutputReadLine();
System.IO.StreamWriter swWriter = pr.StandardInput;
swWriter.WriteLine("echo SomeTextHere\n");
swWriter.Flush();
....
void pr_OutputDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e)
{
MessageBox.Show(e.Data);
}
UMS
|
|
|
|
|
Have a look at this[^] article, it does exactly that.
|
|
|
|
|
Is it possible to format only a few datagridview cells? Please help, thanks!
|
|
|
|
|
I'm not sure of the extent of formatting you plan on doing...but here is what I've done:
private void RowPrePaint( object sender, DataGridViewRowPrePaintEventArgs e )
{
if ( ( ( DataGridView )sender ).Name.StartsWith( "detail" ) )
return;
DataGridViewCell cell = viewer.BatchGrid.Rows[ e.RowIndex ].Cells[ "BatchSelectColumn" ];
bool ThisRowSelected = false;
if (cell.Value != null)
{
ThisRowSelected = cell.Value == DBNull.Value ? false : (bool)cell.Value;
}
ElementState rowState = states[ new Guid(viewer.BatchGrid.Rows[e.RowIndex].Cells["batchGuid"].Value.ToString()) ];
if ( rowState.InvalidDate)
viewer.BatchGrid.Rows[ e.RowIndex ].Cells[ "dateReceived" ].Style.BackColor = Color.LightCoral;
else
viewer.BatchGrid.Rows[ e.RowIndex ].Cells[ "dateReceived" ].Style.BackColor =
ThisRowSelected ? Color.LightSteelBlue : SystemColors.Info;
if ( rowState.OutOfSequence )
viewer.BatchGrid.Rows[ e.RowIndex ].Cells[ "batchNumber" ].Style.BackColor = Color.LightCoral;
else
viewer.BatchGrid.Rows[ e.RowIndex ].Cells[ "batchNumber" ].Style.BackColor =
ThisRowSelected ? Color.LightSteelBlue : SystemColors.Info;
if ( rowState.AmountOutOfBalance )
viewer.BatchGrid.Rows[ e.RowIndex ].Cells[ "dollarAmount" ].Style.BackColor = Color.LightCoral;
else
viewer.BatchGrid.Rows[ e.RowIndex ].Cells[ "dollarAmount" ].Style.BackColor =
ThisRowSelected ? Color.LightSteelBlue : SystemColors.Info;
if ( rowState.CountOutOfBalance )
viewer.BatchGrid.Rows[ e.RowIndex ].Cells[ "formCount" ].Style.BackColor = Color.LightCoral;
else
viewer.BatchGrid.Rows[ e.RowIndex ].Cells[ "formCount" ].Style.BackColor =
ThisRowSelected ? Color.LightSteelBlue : SystemColors.Info;
if ( ThisRowSelected )
viewer.BatchGrid.Rows[ e.RowIndex ].DefaultCellStyle.BackColor = Color.LightSteelBlue;
else
viewer.BatchGrid.Rows[ e.RowIndex ].DefaultCellStyle.BackColor = SystemColors.Info;
}
|
|
|
|
|
Hi
what we write in c#
int a;
int *p=&a;
|
|
|
|
|
You can use pointers in C#, but only in code blocks marked unsafe. Usually you use references.
As an int is not a reference type, you have to box it as an object to get a reference to it:
int a = 42;<br />
object r = a;
To get the integer value back from the object, you cast it:
int b = (int)r;
Note that boxing is much less efficient than working with the plain value types directly, as an object has to be created to contain the value.
---
b { font-weight: normal; }
|
|
|
|
|
int a;
int *p=&a
Not sure. But think it is unsafe code, As I remember it worked in the old Bell Labs 'C'.
Sorry, I just had to.. No hate here.. Just sort of 'funnin' ya!
|
|
|
|
|
unsafe
{
int a;
int *p = &a;
}
Compile with /unsafe
|
|
|
|
|
Hi im a beginner and in need of some help.
im tryin to create a simple Aplication,in which i am using 2 tetbox.In the edit menu I am using ctrl+c and ctrl+v as shortcut for copy and paste. But
ctrl+c and ctrl+v are not working inside the individual TextBoxes
Please help.
Thanks
Rajmohan
|
|
|
|
|
you don't need to write any code for this ctrl-c ctrl-x and ctrl-v...
|
|
|
|
|
there is shortcut property of textbot use it dear
|
|
|
|
|
actually I gonna write a program in CSS,my Question is,how can I make a list with 4 folders with the same image, and with a subfolder with different image, all in one list?
You30
|
|
|
|
|
I don't think that cascading style sheets is the best tool for writing programs...
What kind of folders and images are you talking about, and what has this to do with inheritance?
---
b { font-weight: normal; }
|
|
|
|
|
Hi im a beginner and in need of some help.
im tryin to create a simple chat program like mIRC.
Could someone just explain the concept of how it flows.
I have an idea but not sure if thats how it is.
I have a server-side app, and a client-side app connecting to the server. does the message the client types just get sent to the server and then the server sends the message to all connected clients? how do i go about creating handles for each client connecting to my server?
Please help.
Thanks
|
|
|
|
|
|
i want to create a insert statement for inserting data in a table. Here the column names are stored in one array and the values are stored in another array. Any idea will be of great help for me.
thanx in advance all ur help
|
|
|
|
|
Create a query with parameters that have the same name as the fields, like:
"insert into aTable (Some, Other) values (@Some, @Other)"
Create a command object with the query, and add parameter objects for the parameters.
Do you have the data type for the fields?
---
b { font-weight: normal; }
|
|
|
|
|
public string[] GenInsertCmd(DataTable table)
{
string inscmd = "insert into " + table.TableName.Trim().ToLower() + " (";
foreach(DataColumn col in table.Columns)
{
inscmd += col.ColumnName + ",";
}
inscmd = inscmd.Substring(0,inscmd.Length - 1) + ") values (";
string[] sqlcmd = new string[table.Rows.Count];
int i = 0;
foreach(DataRow row in table.Rows)
{
sqlcmd[i] = "";
foreach(DataColumn col in table.Columns)
{
switch (col.DataType.Name.Trim().ToLower())
{
case "string":
try
{
sqlcmd[i] += "'" + ((string)row[col]).Trim().Replace("'","\"") + "',";
}
catch
{
sqlcmd[i] += "null,";
}
break;
case "datetime":
try
{
sqlcmd[i] += "'" + ((DateTime)row[col]).ToString("yyyy-MM-dd hh:mm:ss.sss") + "',";
}
catch
{
sqlcmd[i] += "null,";
}
break;
case "boolean":
try
{
sqlcmd[i] += ((bool)row[col] == true ? "1," : "0,");
}
catch
{
sqlcmd[i] += "null,";
}
break;
case "byte[]":
sqlcmd[i] += "null" + ",";
break;
default:
if (row[col].ToString().Trim() == "")
sqlcmd[i] += "null,";
else
sqlcmd[i] += row[col].ToString().Trim() + ",";
break;
}
}
sqlcmd[i] = inscmd + sqlcmd[i].Substring(0,sqlcmd[i].Length - 1) + ")";
i += 1;
}
return sqlcmd;
}
|
|
|
|
|
Ouch. Don't use a try statement to handle the null values, use an if statement instead. Exceptions should not be used for normal program flow.
---
b { font-weight: normal; }
|
|
|
|