|
faladrim wrote: what if i have 100 columns??
Then it is likely that your database needs redesigning.
Disclaimer:
I understand that there are cases where tables require 100+ columns. But, from what I've seen, most tables of this size should in fact be broken up into smaller tables with one to one relationships.
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
even 10 i find alot to write the query over and over for every colmn
i need something were i could say:
allcolmns like'%"+textbox.text"%'";
or is there no sutch thing?
|
|
|
|
|
i am trying to figger something out to recreate the query
for (colnr =1; colnr =colamount;colnr++)
{
string colname= dataset.table.colmns[colnr].tostring();
}
by this i get all the names of the colmns wright?
so if i could get this in the query, ill try it for one column:
string colname = dataset.table.colmns[1].tostring(); // get name of col 1
db1DataSet.Tabel1.DefaultView.RowFilter = colname+" LIKE '%" + txt_sort.Text + "%' ";
dataGridView1.DataSource = db1DataSet.Tabel1.DefaultView;
this should do the same as entering the real name of the column just befor" LIKE"
but here i get an error...
|
|
|
|
|
int colnr;
int colamount = db1DataSet.Tables[0].Columns.Count;
string cFilter = "";
for (colnr = 0; colnr < colamount; colnr++)
{
cFilter = cFilter + (cFilter.Length > 0 ? " OR [" : "[") + db1DataSet.Tables[0].Columns[colnr].ColumnName + "] LIKE '%" + txt_sort.Text + "%' ";
}
db1DataSet.Tables[0].DefaultView.RowFilter = cFilter;
dataGridView1.DataSource = db1DataSet.Tables[0].DefaultView;
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
thxxx
im sure it will work, but i most have made an mistake somewere cause i get this error:
System.Data.EvaluateException was unhandled
Cannot perform 'Like' operation on System.Int32 and System.String."
this only happens on a colmn named numbers, in acces i specifided it as text, but i wrote a function to make sure it were numbers.
have you ever come across anything like this? its probebly a stupid mistake
anyway thx for the help
grz
|
|
|
|
|
faladrim wrote: what if i have 100 columns??
So firstly I agree with EricDV, you probably need to rethink the way you are organizing your data.
Secondly, you can create the query string in a loop. Something like this (untested code):
StringBuilder sb = new StringBuilder;
for (int i=0; i <myTable.Columns.Count; i++)
{
sb.Append(myTable.Columns[i].ColumnName + " LIKE '%" + colFilters[i] + "%'");
if (i <myTable.Columns.Count-1)
sb.Append(" AND ");
}
.
.
.
MyTable.DefaultView.RowFilter = sb.ToString();
|
|
|
|
|
Hi.
I want to send voice over phone line.
Suppose I have a wav file, I want to play it on phone line.
I think there is a command for this purpose
Best wishes
|
|
|
|
|
Hi,
You have to use TAPI 3.0 for that.
Codeproject has one article for that,please go through that article.You will definatly get help.
<marquee>nishu
|
|
|
|
|
How can we invoke subclass(derive class) default constructor and base class parametarized constructor at a time from derive class parametarized constructor, Is there any way?
BSK
|
|
|
|
|
No. You can only invoke one contructor in the base class.
---
b { font-weight: normal; }
|
|
|
|
|
kumar.bs wrote: How can we invoke subclass(derive class) default constructor and base class parametarized constructor at a time from derive class parametarized constructor, Is there any way?
I don't think I understand your question. You want to invoke the base constructor from the derived constructor. The base constructor has values, the derived is the default (parameterless) constructor. I'm with you so far. But I don't understand "at a time from derive class parametarized constructor".
class A
{
A(int number, string text)
{
}
}
class B : A
{
B() : base (1, "some text")
{
}
}
B b = new B();
|
|
|
|
|
class A
{
A(int number, string text)
{
// Do stuff
}
}
class B : A
{
B()
{}
B(int i,string str) : base (1, "some text")
{
// Do stuff
}
}
B b = new B(1,"test");
I want to invoke Class B's Default contructor(as well) along with Class A's parametarised constructor, is that possible?
bsk
|
|
|
|
|
kumar.bs wrote: I want to invoke Class B's Default contructor(as well) along with Class A's parametarised constructor, is that possible?
In that situation I create a method called Initialise or some such thing and do something like this:
class B : A
{
B()
{
Initialise();
}
B(int number, string text) : base(number, text)
{
Initialise();
}
private void Initialise()
{
}
}
Also, your code: B(int i,string str) : base (1, "some text") is a bit pointless. What do you do with i and str if you don't do anything with them.
|
|
|
|
|
My Stored procedure in oracle is
CREATE OR REPLACE PROCEDURE GETSOME(ctest out INTEGER) AS
BEGIN
select count(*) into ctest from test;
END;
My Code in C# is
OracleConnection con = GetConnection();
con.Open();
OracleCommand cmd = new OracleCommand("GETSOME", con);
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter op = new OracleParameter("Emp_ID",OracleType.Int32);
op.Direction = ParameterDirection.Output;
cmd.Parameters.Add(op);
cmd.ExecuteScalar();
con.Close();
Its giving me an error
wrong number or types of arguments in call to GETSOME. Can somebody please
explain me what iam doing wrong
|
|
|
|
|
Check the number and type of parameters in your Stored procedure,
and number and type of parameters you are passing to it from your C# code.
Good Luck!
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
HI
i use three panel and each panel there are two or three buttons.
each buton has MouseEnter and MouseLeave events.They are working fine
But whenever i go throght 2nd panel by next button.there are two button
one for Browse a file
another for Browse a folder
whaenever i click on Browse a folder button ,dialogbox appear and work fine
But when i click on Browse for file button if appear over the form and also covered the button and dispaly exception at MouseEnter event .
and whenever i comment the MouseEnter event line it dispaly error in Mouse
leave event.
and when i comment this line also it dispaly same exception at another control Mouse event
plz help
parshant
|
|
|
|
|
Telling what exception you are getting is generally more helpful than
Parshant Verma wrote: dispaly exception at MouseEnter
only two letters away from being an asset
|
|
|
|
|
it display exceptio:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in system.drawing.dll
Additional information: png1\001.png
and also open a Disassmebly and point to
00000056 mov ecx,esi
|
|
|
|
|
|
Exception says file not found i am getting
but the same code working with another button Folder browse.
|
|
|
|
|
Parshant Verma wrote: But when i click on Browse for file button if appear over the form and also covered the button and dispaly exception at MouseEnter event .
I don't understand what you mean by that sentence. What is appearing over the form?
---
b { font-weight: normal; }
|
|
|
|
|
my mean it this whenever i click on file button OpenFileDialog open and covered the file button
Might be it relate to exception that why i told this point
|
|
|
|
|
I see.
What is the exception that you get, and what does the code look like?
---
b { font-weight: normal; }
|
|
|
|
|
exception i am getting file not found
but before click on the file button everything going perfect and the same evevt is fine working
private void btn_select_file_MouseEnter(object sender, System.EventArgs e)
{
try
{
file.Image=System.Drawing.Image.FromFile(@"png1\002.png");
}
catch (System.Exception e1)
{
MessageBox.Show(e1.Message.ToString());
}
}
private void btn_select_file_MouseLeave(object sender, System.EventArgs e)
{
try
{
btn_select_file.BackgroundImage=System.Drawing.Image.FromFile(@"png1\001.png");
}
catch (System.Exception e2)
{
MessageBox.Show(e2.Message.ToString());
}
}
private void btn_select_file_Click(object sender, System.EventArgs e)
{
if(openFileDialog.ShowDialog()==DialogResult.OK)
{
btn_select_file.DialogResult=DialogResult.OK;
btn_select_file.BackgroundImage=System.Drawing.Image.FromFile(@"png1\002.png");
txt_select_file.Text=openFileDialog.FileName.ToString();
SelectButton=1;
btn_select_folder.Enabled=false;
}
}
|
|
|
|
|
This last information that you provided suddenly makes the error very obvious. It has nothing at all to do with event handling.
You are opening files using a relative path, that means that you are using the current working directory as a starting point. The file selector dialog also uses the current working directory, and changes it as you navigate through the folders. That means that your code is trying to open the image files from a different starting point, where the images doesn't exist.
The quick solution would be to store the value of the current directory when starting the application, so that you could use that value for locating the images. But I don't understand why you create a new Image object from a file every time the mouse pointer enters or leaves the control. You'd be better off by loading the images at startup, so that you can use the same Image objects over and over.
---
b { font-weight: normal; }
|
|
|
|