|
Throwing exception would be fair enough.
Best wishes,
Navaneeth
|
|
|
|
|
i want to filter something like string type in my textbox but my code is not working..how do i fix this
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
bindingSource1.Filter = "LASTNAME = LIKE% + textBox1.Text";<br />
bindingSource1.Sort = "LASTNAME ASC";<br />
}<br />
<br />
<br />
|
|
|
|
|
According to the example on MSDN[^], you'd need to re-assign the bindinsource to the datagridview;
BindingSource1.Filter = "LASTNAME='Owner'";
BindingSource1.Sort = "LASTNAME ASC";
dataGridView1.DataSource = BindingSource1;
I are Troll
|
|
|
|
|
crisjala wrote: bindingSource1.Filter = "LASTNAME = LIKE% + textBox1.Text";
You might also want to pick up a book on beginners C# and work through it. It seems you have no idea how strings work.
This line should be closer to
bindingSource1.Filter = @"LASTNAME LIKE% " + textBox1.Text;
though using user input directly without validating it could be considered one of the great sins of programming.
|
|
|
|
|
I'm trying to find a cleaner way to reflectively get at the contents of my class that are lists of other classes:
class BigClass
{
public List<LittleClass1> LittleList1;
public List<LittleClass2> LittleList2;
public string BigString;
}
class LittleClass1
{
public string a;
public int b;
}
class LittleClass2 : LittleClass1
{
public string c;
}
To look into BigClass I use
foreach (FieldInfo fi in BigClass.GetFields())
{
if (fi.GetValue(bigClassInstance).ToString().StartsWith("System.Collections.Generic.List"))
{
}
}
It finds the lists, and I can process them from there, but there must be a better way.
|
|
|
|
|
Try the is and as operators rather than string comparisons.
And probably look for IEnumerable rather than List .
|
|
|
|
|
Thank you. I'll put up a big sign on my desk with "is " and "as " and ToString() so I don't have to ask this again.
|
|
|
|
|
|
is it possible to update twitter status from my C# application using textbox?
|
|
|
|
|
Absolutely, since Twitter has an interface built in to everything. In fact, if you write text on a paper tablet it will update your Twitter account also, magically, with no coding at all.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I'm pretty sure it's even built into tiolet paper judging by some of the posts.
Don't blame me. I voted for Chuck Norris.
|
|
|
|
|
Try googling before asking next time. For a question like this, I'd suggest the terms 'Twitter API'. This is the first result.
http://apiwiki.twitter.com/[^]
|
|
|
|
|
...I'm hoping that this is a stupid question:
I'm needing to pull a CLOB field off of an Oracle table. It just so happens that the character string that was input into that CLOB field conforms to an XML Schema, with a few character replacement tweaks that I have to scrub. less than signs have been replaced with amp lt; and greater than signs have been replaced with amp gt;
I mention that because it throws a significant wrinkle into the processing that I have to do. I have to pull a CLOB out of a DataReader's stream, scrub the string, and then dump the string back into a (MemoryStream???) to pass into the XML DOM objects. I have no idea if this is even close to what I need to be doing, as I have very little experience working directly with Streams in this way.
Can someone tell me how they would go about pulling the string data out of the DataReader stream and passing it into an XMLTextReader as a separate stream for parsing?
Am I even on the right path?
"I need build Skynet. Plz send code"
|
|
|
|
|
hi, I create a table with the below code. Everything is okay but I can not set the "identity specification" property to yes.
This is okay without identity parameter
SqlCommand cmd = new SqlCommand(@"Create table ItemStock (Itemno tinyint, Urun nchar(20),Fiyat float, primary key(Itemno))", baglan);
This is not okay with identity parameter
SqlCommand cmd = new SqlCommand(@"Create table ItemStock (Itemno tinyint, Urun nchar(20),Fiyat float, primary key(Itemno), Set Identity_insert(Itemno) on", baglan);
|
|
|
|
|
try somewthing like this:
SqlCommand cmd = new SqlCommand(@"Create table ItemStock (Itemno tinyint IDENTITY(1,1) Primary Key Clustered,
Urun nchar(20),Fiyat float)", baglan);
If it still doesn't work try replacing the type from tinyint to int.
the (1,1) after IDENTITY represents the identity seed(start) and the increment.
|
|
|
|
|
worked fine with tinyint, thank you very much! By the way, I used Primary key(columnname) but you mentioned Primary key Clustured. what is the difference?
|
|
|
|
|
A clustered index will store the records in approximately the order of the index. That can be useful if you read a range of records because they can all be read from the hard drive without performing extra seeks. Since the data can only be ordered one way, you can only have one clustered index on each table. Typically, the primary key is chosen as the clustered index, unless you have a good reason to choose another one.
|
|
|
|
|
|
I'm trying to pass a variable from a GridViewRowEvent method to a DataListItemEvent method in a C# program.
I have the following:
public void My_RowDataBound2(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
int lblAmount = (int)DataBinder.Eval(e.Row.DataItem, "Amount");
totalAmount += lblAmount;
x += 1;
}
else
{
CountNumberRows(x);
}
}
public int CountNumberRows(int x) { return x; }
public void My_ItemDataBound(object sender, DataListItemEventArgs e) {
if (e.Item.DataItem != null)
{
Label dummyVariable = (Label)e.Item.FindControl("abc");
abc.Text = CountNumberRows(x).ToString();
}
}
Then in my ASP.NET file I have the following entry:
DataList
...
Gridview
...
Gridview
...
<asp:Label ID="abc" runat="server"></asp>
...
DataList
And I get just "0" for the "abc" value in my file. I know the GridViewEvent method works because the variable
totalAmount correctly sums up all the data each time it is called by My_RowDataBound2, and inserted into the appropriate place in the GridView on my ASP.NET Page. But "abc" just shows 0. abc is just supposed to show the number of rows contained in the GridView.
Basically, I just need to get the "x" value from
My_RowDataBound2 method, pass it to the
My_ItemDataBound event which then passes it as a label to the ASP.NET Page. But the label is just showing "0"
If I take:
public int CountNumberRows(int x) { return x; } and change it to:
public int CountNumberRows(int x) { x= "123"; return x; } , it passes the "123" to the abc label. But I don't know how to pass the x calculation out of the GridView to the DataList. Any suggestions? I appreciate your help
|
|
|
|
|
Dear all,
How can i get the names of the directories of a ftp server in c#?
Thanks.
|
|
|
|
|
FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + server + "/"));
ftp.Method = WebRequestMethods.Ftp.ListDirectory;
WebResponse response = ftp.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi Mark,
Thank you for reply, but with this code you will get the file names.
What i need is the folder names.
|
|
|
|
|
You have what you need to research for yourself
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
In C# app i need to check if a file is a text file or is a binary file,
how can i do this ?
i can't check by file extension, because isn't meaningful for me .
|
|
|
|
|