|
I actually needed a dataset recently, the proc was returning 2+ tables and was surprised my DAL had a method to support it. Datatables are the basic container in my DAL.
I found performance dropped off dramatically when returning multiple tables from a single proc.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
If performance and overhead is important, then don't use datasets (IMHO).
Use a datareader to get the data and populate objects (and collections thereof) and return them.
Do whatever is required to the objects, and have methods to re-populate the DB from teh new values.
Depending on your requirements you may need to have your objects implement interfaces or inherit from base classes that 'know' if they are new (to the DB) or have been changed - but that's fairly simple in most cases (again, without knowing the requirements it's difficult to judge)
The important thing, I think, is that if performance and overhead are important, writing it yourself will always be more efficient (OK, assuming you write it well) than a 'generic' solution.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Hi,
I 'm using c#.net(3.0),I want to extract audio from an AVI file(Audio/Video file *.avi) in wav format(*.wav) could anyone please tell how to do this using C#.net.
I'm using the AviFile.dll provided with source code at this link http://www.codeproject.com/KB/audio-video/avifilewrapper.aspx but the given example is not working with all *.avi.It is only working with the given test data.
thank you
|
|
|
|
|
I know nothing about how to do this in C# but one way or another, you will have to use some external library or program. In that case I suggest you dig some information on typical video-processing command line programs (mencoder, ffmpeg, others) and if you run then with the right switches, the'll do exactly what you need. I'm sure mencoder can extract audio, I just don't know the exact switches - google this.
If you want this in C# from scratch, you are looking at a LOT of work.
H.
|
|
|
|
|
It says I can't power up a double and a double
double a = 1.8;
double b = 2.9;
a = a ^ b ;
any ideas?
|
|
|
|
|
b cannot be a double, that is correct.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Use Math.Pow() instead.
H.
|
|
|
|
|
|
<code>^</code> is the logical <a href="http://msdn.microsoft.com/en-us/library/zkacc7k1(VS.80).aspx">XOR</a>[<a href="http://msdn.microsoft.com/en-us/library/zkacc7k1(VS.80).aspx" target="_blank" title="New Window">^</a>] operator. As was mentioned upthread you need to use <code>Math.Pow</code>.
It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.
-- Pride and Prejudice and Zombies
|
|
|
|
|
Did you ever screw that one up
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I wrote a program that will search AD and pull all the users int a combo box and then you select the user to unlock and it unlocks the locked out account awesome !
to make things quicker i want to know how could i only populate the combo box with locked accounts ?
thank you for your time
|
|
|
|
|
I have code for a calculator, and continue to get an error that I cannot seem to find.
The error: The type or namespace name 'ArrayList' could not be found(are you missing a using directive or an assembly reference)
I have partial classes, delaring the following in the Calculator.Designer.cs
private string m_value;
private ArrayList m_store;
the rest of the code below is in the Calculator class:
Can someone see what might be missing?
Here is the code:
public partial class Calculator : Form
{
public Calculator()
{
InitializeComponent();
m_value = "";
m_store = new ArrayList();
}
private void btnSeven_Click(object sender, EventArgs e)
{
AddToArray(btnSeven);
}
private void btnEight_Click(object sender, EventArgs e)
{
AddToArray(btnEight);
}
private void btnNine_Click(object sender, EventArgs e)
{
AddToArray(btnNine);
}
private void btnFour_Click(object sender, EventArgs e)
{
AddToArray(btnFour);
}
private void btnFive_Click(object sender, EventArgs e)
{
AddToArray(btnFive);
}
private void btnSix_Click(object sender, EventArgs e)
{
AddToArray(btnSix);
}
private void btnOne_Click(object sender, EventArgs e)
{
AddToArray(btnOne);
}
private void btnTwo_Click(object sender, EventArgs e)
{
AddToArray(btnTwo);
}
private void btnThree_Click(object sender, EventArgs e)
{
AddToArray(btnThree);
}
private void btnZero_Click(object sender, EventArgs e)
{
AddToArray(btnZero);
}
//create method for array to calculate
private void AddToArray(Button btn)
{
//m_value this to set the value
m_value += btn.Text;
//set label lblResult = " to display it to user
lblResult.Text += btn.Text;
//make all enabled to use it
SetEnableOperatorBtns(true);
}
private void btnAdd_Click(object sender, EventArgs e)
{
AddOperatorToArray(btnAdd);
}
private void btnSubtract_Click(object sender, EventArgs e)
{
AddOperatorToArray(btnSubtract);
}
private void btnMultiply_Click(object sender, EventArgs e)
{
AddOperatorToArray(btnMultiply);
}
private void btnDivide_Click(object sender, EventArgs e)
{
AddOperatorToArray(btnDivide);
}
// Method to add the operator to the array
private void AddOperatorToArray(Button btn)
{
//add the value to the arrayList
m_store.Add(m_value);
//display the Result to user
lblResult.Text += btn.Text;
//make the value empty
m_value = "";
//add the opeator to arrayList
m_store.Add(btn.Text);
//make the decimal button enabled
btnDecimal.Enabled = true;
//call the SetEnableOperatorBtns(false); to make all operators unenabled
SetEnableOperatorBtns(false);
}
private void Reset()
{
m_value = "";
lblResult.Text = "";
m_store.Clear();
btnDecimal.Enabled = true;
}
private void SetEnableOperatorBtns(bool enable)
{
btnAdd.Enabled = enable;
btnSubtract.Enabled = enable;
btnMultiply.Enabled = enable;
btnDivide.Enabled = enable;
btnEquals.Enabled = enable;
}
private void btnDecimal_Click(object sender, EventArgs e)
{
//Add to arrayList
AddToArray(btnDecimal);
btnDecimal.Enabled = false;
}
//m_result here take the first element in m_store if this element is
//operator like +*-/, Exception gives us error else if will take the
//digits or dot point
private void btnEquals_Click(object sender, EventArgs e)
{
try
{
// add value to the arrayList
m_store.Add(m_value);
// add operator to the arrayList
m_store.Add(btnEquals.Text);
//take the first element in the array, make sure its a digit
//and then save it on m_result, else it will give exception
float.m_result = float.Parse(m_store[0].ToString());
//loop extracts all elements in arrayList then checks it
//if the element is operator it will calculate the prefix and
//postfix and give us the result
//for loop on arrayList and check for element if equal to opera or not
//if equal operator
for (int i = 0; i < m_value.Length; i++)
{
if(m_store[i].ToString() == "+")
{
lblResult.Text = "";
m_result += float.Parse(m_store[i+1].ToString());
lblResult.Text = m_result.ToString();
}
else
if(m_store[i].ToString() == "-")
{
lblResult.Text = "";
m_result -= float.Parse(m_store[i].ToString());
lblResult.Text = m_result.ToString();
}
else
if(m_store[i].ToString() == "*")
{
lblResult.Text = "";
m_result -= float.Parse(m_store[i].ToString());
lblResult.Text = m_result.ToString();
}
else
if(m_store[i].ToString() == "/")
{
lblResult.Text = "";
m_result -= float.Parse(m_store[i].ToString());
lblResult.Text = m_result.ToString();
}
}
m_store.Clear();
m_value = lblResult.Text;
for(int i=0; i < m_value.Length; i++)
{
if(m_value[i].ToString() == ".")
{
btnDecimal.Enabled = false;
break;
}
else
{
btnDecimal.Enabled = true;
}
}
btnEquals.Enabled = false;
}
catch(Exception exception)
{
MessageBox.Show(exception.Message, "Error");
}
}
private void btnClear_Click(object sender, EventArgs e)
{
Reset();
}
|
|
|
|
|
You forgot to include using System.Collections ?
|
|
|
|
|
I already had the using System.Collections.Generic;
but added the using System.Collections;
The errors I am getting are that:
m_value does not exist in current context
m_store does not exist in current context
|
|
|
|
|
Hi,
some remarks:
1.
the ArrayList class you probably want is located in namespace System.Collections, hence it needs a using System.Collections; statement in every file that wants to use it.
This is different from using System.Collections.Generic;
2.
you should no longer use ArrayList, instead use List<T> which is a generic list holding objects of type T only (your choice of T!); it is supported since .NET 2.0
The generic collections require a using System.Collections.Generic; which you get for free when using Visual Studio.
3.
your ArrayList is appearing in a Calculator.Designer.cs file? I have never seen the Designer use ArrayList like that, and you should not edit designer generated code at all. Put your code in Calculator.cs file, in the constructor, the Load handler, whatever.
|
|
|
|
|
The only code I had in the Designer.cs file was:
private string m_value;
private ArrayList mstore;
The rest of the code is in the is in the Calculator.cs file.
So now I have made the change:
private string m_value;
private List<t>; m_store; // moving the declarations to the cs. file
public Calculator()
{
InitializeComponent();
m_value = "";
m_store = new List<t>();
}
When I remove the values above, the private calls, I get even more errors.
Is using partial classes possibly causing my errors? The code was original in a publ class.
|
|
|
|
|
Hi,
the variable declarations that used to be inside Calculator class in Calculator.Designer.cs file need to be inside Calculator class in Calculator.cs file. And that file needs all the import statements that lead the compiler to recognize the classes you are using (such as System.Collections.Generic for generic lists).
If you plan on accessing m_value and m_store from outside the Calculator class, you would need to change their attribute from private to public, or better yet provide public methods or properties.
I recommend you buy and study a tutorial book on C#, that would guide you step-by-step and teach you good practices from the start.
|
|
|
|
|
Hi,
I am using the CSML libraries which are just what I need. However, it looks like the precision when doing matrix manipulations (taking inverses and matrix multiplication) is only to 4 decimals, even though I'm using doubles. Internally it has to be using many more, but I can't get it to display or use more in further calculations. Suggestions please.
Linda
Linda Woodard
|
|
|
|
|
Hi,
I'm not familiar with the CSML libraries. AFAIK there are only two ways to get bad results with matrices: using a bad algorithm (e.g. not applying pivots), which I don't expect a library to get wrong; and operating on very peculiar matrix values (as in searching the intersection of two almost parallel lines).
Of course, you may have made some silly mistake somewhere outside the library too, as in performing some operations in lower precision, maybe in integers.
Example: int a=1; int b=2; double c=a/b*100.0; would yield c=0.0; !
|
|
|
|
|
I think it's only a matter of displaying the result. Check out some topics on number formatting in MSDN, that should help. Try for example
double x = SomeCalculation();
string resultToDisplay = x.ToString("F9");
to get 9 significant digits, but I am sure there are better ways.
H.
|
|
|
|
|
Thanks. I think this will help. I need to actually use the results, not really display them, but I know how to do that. Painful and inelegant, but at this point...
Linda
|
|
|
|
|
This looked like it should work and it does if you are dealing with doubles. Unfortunately I'm dealing with matrices and the Matrix.ToString() does not take any arguments. So I'm still looking.
Linda
|
|
|
|
|
Hi there,
Thanks for taking interest in my question. Actually, I wanted to know the process of creating a Gel Button (Stylish, glowing, shining and colourful button control) in Visual C#. I went through many tutorials in both google and MSDN, but all of them mentioned WPF in them and the code was in XAML. I have not started programming in XAML or WPF yet, but I know that they can be used to create graphically rich UI applications. However, is there any way I can create Gel buttons in Visual C# for my Windows form? Please help.
Thank you,
Rajdeep.NET
|
|
|
|
|
|
Hello,
I have been struggling for the past 3 days to do this but I simply can't find any good info on how to do it.
Please let me explain what I want.
I have a compiled software. I want users to be able to brand this software with their own ICON, ABOUT IMAGE and DETAILS.
How can I do this ?
In my oppinion, there are 2 ways to do this :
add the image and details file in to the exe and also, change the exe icon. I don't think this is possible.
create an exe from my application, that will automaticaly add in it the Brandable Software File, About Image and Details file. When I run this newly created exe, it can extract the files in a temp file and run the Branded software.
How can I do that ? Is there any other way ? Did I explain correctly what I want ?
PS: I am programming in VS 2008 c# with .net 3.5
Thank you
|
|
|
|