|
uroojkhanpk wrote: can v create an array or collection of SqlParameter and how?
Yes:
SqlParameter[] parameters = new SqlParameter[numParameters];
parameters[0] = new SqlParameter.....
uroojkhanpk wrote: if so then how it will be added to the SqlCommand object?
Loop round the array adding each parameter. See the example on MSDN: SqlCommand.Parameters Property[^]
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Thanks a lot Colin Angus Mackay!
|
|
|
|
|
hai all,i read the whole word document and store it into the string and i pass this string into the database,but the size of the .doc is more so i try get only the content of the document(as in naukri) into the string and store the string into db but i didn't get what i want.is there any way to do this?
help me plz..........
my need is:only the content of the document should be transferred to db not all the things in word doc like tabel,specialchar.etc.
ayyp
|
|
|
|
|
I am trying to determine the feasability of converting the SAC Java classes for CSS parsing from from Java to C#. I thought I had read somewhere that you could convert the Java classes to J# then convert them to C#. Also, I thought I had seen a Java converter program from Mircosoft.
Anyone have any suggestions if this is possible and maybe the best approach to take?
|
|
|
|
|
I've never tried J# before. But if you can use your code in J#, then you can also use your code in C#. Just compile your code using J# into DLL and use this DLL from C#.
|
|
|
|
|
Hey,
Check it out bellow link, u wil get some idea.
And try the demo software and you can convert the code,
http://www.tangiblesoftwaresolutions.com/Demo.htm
Thanks,
Mayuri...
|
|
|
|
|
Does anyone know any good c# platforms for developing quick applications in SNMP e.g. agent, manager development. Any known good examples of SNMP c# examples.
Cheers
Mike
|
|
|
|
|
i have a .txt file that i have data in there that is seperated using comma and i want to read from this text file and collect all of the data from the text file
for example
:::::::::::::::::::::::::::
12/4/2005,pin
23/4/2006,unpin
i want to be able to read something like that and get all of the informations seperately so i kno that for the first line i have 12/4/2005 and pin differently and liewise for the other line
? can someone prob point me out to a tutorial that can show me how to do this or possibly show me a snippet of code to do this............
and in general i wold appreciate any links to tutorial for c# also
__________________
kenny
|
|
|
|
|
Search "Reading a text file in C#" in google.
Once you have a line of text from the file you can use string.Spilt(','); to seperate the info. Something like:
string currentText;
string [] seperated = currentText.Split(',');
|
|
|
|
|
Thanks Sean89 i tried the snippet of code u gave me and i was able to sperate this sample text string i put in my code just to check
::::
string cfvText="kenny,edmond,walker" ;
:::::::
so i am goign to try and find a tutorial as u say that will assist me to read from a file in c# now, thanks again
kenny
|
|
|
|
|
using(StreamReader sReader = new StreamReader(@"c:\temp\test.txt"))
{
string text = string.Empty;
while((text = sReader.ReadLine()) != null)
{
Console.WriteLine(text);
}
}
|
|
|
|
|
I have dropdown list with over 50 list item. Based on each selection i want to call a function which populate the DataGrid.
Currently, I am doing it following way .. but calling switch case 50 times sounds tidius .. there has to be a better way... seems like it's very common .. for example ... select a State from the dropDownlist and instead of DataGrid they are populating another drpodownlist which is cities in that state.
protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e)
{
string tableName = DropDownList1.SelectedItem.Text;
switch (tableName)
{
case "Address":
GetAllAddressData();
break;
case "State":
GetAllAddressData();
break;
.......................
Any ideas or suggestions are really appriciated ...
Thanks
|
|
|
|
|
As far as i am aware, the standard way of doing it would be have your query / SP text that u will be using to populate your data. On select, read the key out of the selected item, and insert it into your query string, and execute.
i.e.
<br />
protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e)<br />
{<br />
const int DEFAULT = 0;<br />
const string SQL = "EXEC GetStateListByID {1}"<br />
<br />
int liIndex;<br />
string lstrSQL;<br />
<br />
liIndex = (int)DropDownList1.SelectedItem.Value;<br />
<br />
if(liIndex == DEFALT)<br />
return;<br />
<br />
lstrSQL = string.Format(SQL, liIndex)<br />
<br />
<br />
this.PopulateDataGrid(lstrSQL);<br />
<br />
}<br />
<br />
That's the simple version anyway. Hope it helps.
Tris
|
|
|
|
|
Thanks a lot.
I am working with n-tier and also Controll - model MSUserInterfaceProcess and from business tier I get dataset back. So I can't use the direct query but this gave me an another idea to try. Thanks a lot again. I was stuck but your suggetion triggered a new thought process.
Thanks
|
|
|
|
|
Hi All,
I have two multiline textboxes one above the other that both have horizontal scroll bars.
How would I make it so that when one scroll bar is moved, the other textbox's scroll bar is also automatically adjusted so that they always line up?
Thanks
|
|
|
|
|
Hi
I've the following line:
MethodInfoArray[i].Invoke(new object(),datafrominputs);
where datafrominputs is an object[] containing 2 or more items. I defined the method it is invoking like this:
static public int function(params int[] numbers)
Am I correct in assuming this will allow any number of inputs? why do I get a TargetParameterCountException?
cheers
|
|
|
|
|
datafrominputs needs to be object[][] of size 1 and the original object[] should be the first element. iow:
MethodInfoArray[i].Invoke(new object(), new object[] { datafrominputs });
|
|
|
|
|
I have to parse some XML files (more than 5.000 files). All of them are compressed with gzip, and so does the DTD of each one.
Using GZipStream, I can read the XML (i'm using XPathDocument), but it generates an exception "Expected DTD markup was not found", because the DTD also is gzipped.
I did a test, replacing the DTD of one XML with a normal file (not compressed), and it worked.
Is there any way to parse these XML files without having to extract the DTD, decompress them and modify the DTD reference in the XML files?
Thanks in advance!
|
|
|
|
|
I have an interface defined called A
Its class behind it is class B.
I do not allow direct creation of this class.
But, I need to allow the classes to grab events from there.
Can I define events for an interface?
Or whats the best pattern to implement to allow for such events, without making the class publicly creatable?
Thanks,
Nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
Ista wrote: Can I define events for an interface?
Sure you can. Syntax is nearly the same as for normal classes. Just leave the visibility modifier away.
|
|
|
|
|
actually no. If you define an event it will think its a field. Which is ilegal in an interface.
Unless you know of a different way
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
public interface ITest {
event EventHandler MyEvent;
}
public class TestA : ITest {
public event EventHandler MyEvent;
}
... works or am I totally misunderstanding you?
|
|
|
|
|
your right. sorry.
I didnt put the handler in and wasn't paying attention I guess.
Thanks.
I created an observer class instead
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
I want to set text button to specific date, I want to set it to always show
for examle the date of monday or tuesday.
It should looks like this button1.Text=...
What I need to type in.
I tried but I know only how to set it to current date.
In my project I want to looks like this
I have seven buttons, and each button.text sholud be equal to other day of week
button1 to date of monday's etc.
How can i do this??
Please help.
|
|
|
|
|
Hi there!
If i understood correctly you want for example
Button1.Text = "5/29/06"
Button2.Text = "5/30/06"
and so on... for complete week!
This isn't very difficult (just a small example)
private void Form1_Load(object sender, EventArgs e)
{
button1.Text = DateTime.Today.ToString();
button2.Text = DateTime.Today.AddDays(1).ToString();
button3.Text = DateTime.Today.AddDays(2).ToString();
}
the AddDays increase the actual Date by the value you paste in... hope that's what you asked for... the ToString() converts the date into a text string, so that the button can handle it!
Bye!
FreewareFire is in the House!
|
|
|
|