|
I am new to C#, so any one can help me to understand the => operator in C# or give me some resource on this.
Thanks in advanced.
|
|
|
|
|
This (=>) is called the Lambda operator.
This will help you generate lambda expressions.
You specify input parameters (if any) on the left side of the lambda operator =>, and you put the expression or statement block on the other side.
For example, the lambda expression x => x * x specifies a parameter that’s named x and returns the value of x squared.
|
|
|
|
|
Thanks Abhinav S so much!
|
|
|
|
|
The => operator in C# is for an example
if your int is equals or more then the other int.
I hope this help
//XoulsZ
|
|
|
|
|
No, that's wrong. Let me tell you: => != >= !
|
|
|
|
|
|
|
I am having a linq to sql problem with a C# 2010 windows form application when it is changed to a dll and accessed by other applications. The purpose of the calling the code as a dll is for performance reasons and to share the code accross multiple applications.
When the application is on its own, it runs fine.
Basically when the linq to sql was dragged to the desktop, a default linq to sql connection was setup by the .net framework. However I changed the *.designer.cs to use the system.configuration namespace,
added a reference to the system.configuration namespace, and changed the default linq to sql connection to use the database connection obttained in app.config file. I also removed any refernces to the default database connections in the the 'properties or 'settings' section for each project file folder.
Now the problem is the default setting values to the database are reset by the .net framework. Thwe values in the app.config file are no longer being used.
Can you show me code, point me to a reference, and/or tell how I can make this application is the connection string values in the app.config file again?
|
|
|
|
|
sc steinhayse wrote: I changed the *.designer.cs to use the system.configuration namespace, You must not manually edit this file as it will get reset by Visual Studio. You need to add code elesewhere to manage your connection.
Use the best guess
|
|
|
|
|
Can you tell me how to change the code so that it is better managed? I definitely need to obtain the database connections from the app.condif file.
|
|
|
|
|
You can get the configuration settings in your main program's code and then pass it in to the method that does the database access, the same as you would any method that accepts input parameters.
Use the best guess
|
|
|
|
|
Hi,
I have a products table in my database. I want to display the products from my table as Buttons on the form not as Grid so user will click the button of each product.
I want to display the product name (or image) on the button and assign the product id as button tag
How can I do this please?
Technology News @ www.JassimRahma.com
|
|
|
|
|
Try:
Button but = new Button();
but.Image = Image.FromFile(pathToImage);
but.Text = "";
but.Tag = productId;
but.Click += new EventHandler(button_Click);
but.Location = new Point(X, Y);
but.AutoSize = true;
Controls.Add(but);
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
|
i want to use my windows application both offline and online. when it connect to internet ,it should synchronize my data and should visible to everybody those who use this software.i am using vs 2010 and SQL server 2005.
|
|
|
|
|
Very interesting; now do you have a question?
Use the best guess
|
|
|
|
|
Snap!
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
|
We really need to get out more ...
Use the best guess
|
|
|
|
|
|
How can i do this problem?.Please help me to solve this
|
|
|
|
|
Good for you!
That sounds like a good idea.
Now, what have you done so far to make it happen? (Other than tell us what you want here)
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
|
i can use the software offline.when it connect to server, the data should be synchronized. and all other users get this updated data.
|
|
|
|
|
|
Take a look into the Microsoft Sync Framework.
|
|
|
|
|
hi,
i am trying to create an .xls file from a data table and saving it in application local folder. all this i am doing for a web application. everything is fine until i end with an error. so please look into below error and help me out with a solution
Error :
Microsoft Excel cannot access the file 'E:\Syed Project\E-Comply_Project\E-Comply Source Code\COC_Export\'. There are several possible reasons:
. The file name or path does not exist.
. The file is being used by another program.
. The workbook you are trying to save has the same name as a currently open workbook.
Code :
public void DTToExcel(System.Data.DataTable dt, string filePath)
{
try
{
Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook xlWorkBook;
Microsoft.Office.Interop.Excel.Worksheet xlWorkSheet;
object misValue = System.Reflection.Missing.Value;
xlWorkBook = xlApp.Workbooks.Add(misValue);
xlWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
string data = string.Empty;
for (int i = 0; i <= dt.Rows.Count - 1; i++)
{
for (int j = 0; j <= dt.Columns.Count - 1; j++)
{
data = dt.Rows.ItemArray[j].ToString();
xlWorkSheet.Cells[i + 1, j + 1] = data;
}
}
xlWorkBook.SaveAs(filePath + "\\" + "BOM_Matched_ExcelReport.xls", Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
xlWorkBook.Close(true, misValue, misValue);
xlApp.Quit();
releaseObject(xlWorkSheet);
releaseObject(xlWorkBook);
releaseObject(xlApp);
}catch(Exception Ex)
{ throw Ex; }
}
Thanks & Regards,
Sateesh kumar Singupuram
sateesh kumar singupuram
|
|
|
|
|
Does the application / user have permission to write to that folder?
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|