|
Firstly, are you using Windows Security (trusted connection) or SQL Server security (you have a separate username and password for SQL Server)?
Does everyone who's going to use your application access SQL Server the same way? Do all your users have access to SQL Server?
These are the things that you need to determine before going forwards. If everyone in your workplace has a trusted connection to SQL Server and access to the DB, then you don't need to provide username and password information in your connection string. Otherwise, you'll have to get a username and password from each user (to include in the connection string) before they can get access to the SQL Server DB.
I hope this helps.
|
|
|
|
|
Hi,
I often end up with a collection of items I have to process. Say - an arraylist of "commands". I want to process these command and then delete the command from the collection. As you cannot modify a collection during a foreach, I often process it in reverse and delete the last (just processed) item like this
lock (col)
{
for (int i = col.count-1 ; i <=0 ; i--)
{
processItem(col[i]);
col.RemoveAt(i);
}
}
Is there a better way to do this ?
/Jan
Do you know why it's important to make fast decisions? Because you give yourself more time to correct your mistakes, when you find out that you made the wrong one. Chris Meech on deciding whether to go to his daughters graduation or a Neil Young concertp
|
|
|
|
|
Maybe something like that:
while(col.count > 0)
{
processItem(col[0]);
col.RemoveAt(0);
}
But I am not sure it is a better way
|
|
|
|
|
Jan R Hansen wrote: want to process these command and then delete the command from the collection.
Since processItem() doesn't know anything about the commands in the collection (other than the one it's processing), you might consider simply doing this:
lock (col) {
foreach (Command c in col)
processItem (c);
col.Clear();
}
If Command is a heavyweight object, you could try this approach:
lock (col) {
for (int i=0; (i < col.Count); i++) {
Command c = col[i] as Command;
processItem (c);
col[i] = null;
}
col.Clear();
}
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Thanks - I overlooked that I had to lock the collection anyway, so I could just as well use the topmost example. Thanks again !
Do you know why it's important to make fast decisions? Because you give yourself more time to correct your mistakes, when you find out that you made the wrong one. Chris Meech on deciding whether to go to his daughters graduation or a Neil Young concert
|
|
|
|
|
Hi all,
I had posted a message earlier on this topic but i did not
get a satisfactory reply,
Please if anyone of u could tell me how to login to
a blog and then post an article to it from a C# windows application.
Thanks & Regards,
Pramod
|
|
|
|
|
You'll have to be more specific than that. What is the blog software? - some provide webservice access which you can use, others don't.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
i have created a blog on Wordpress.com
and i want to post some data on that blog
so what should be done?
Do these blog providing sites release any API's for this?
Thanks & Regards,
Pramod
|
|
|
|
|
Yadav Pramod wrote: Do these blog providing sites release any API's for this?
If the process of posting an entry is performed via a web form, you can harness the "post entry" functionality by creating a WebResourceProvider[^].
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
i want to do that in C# windows Application
Pramod
|
|
|
|
|
Yadav Pramod wrote: i want to do that in C# windows Application
Yes, I know. Do you have a specific question?
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Ya, My question is how to post the data
on an existing blog?
Pramod
|
|
|
|
|
Yadav Pramod wrote: how to post the data on an existing blog?
View the source of the html page that allows you to post your blog entry. It's likely to be a form of some sort. Then, write a web resource provider[^] to mimic that action. See the GoogleTranslator[^] article for an example.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
I'm having trouble saving a workbook. I show a SaveFileDialog, the user specified where he wants to save the file, and where. When the user clicks on Save button, I say SaveAs... and do something else with the file (after the file is saved). Anyway, that's what it should do.
My code for saving is this:
this.SaveAs(fileName, Excel.XlFileFormat.xlXMLSpreadsheet, missing, missing, false, false, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, missing, false, missing, missing, true);
It simply doesn't save the xls file. Does anybody have any idea why?
---------------------------------
Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe. (Albert Einstein)
|
|
|
|
|
Hi,
I want to display Radiobuttons in one of the Columns of DataGridView. Is it possible? if possible please help me.
Thanks in Advance.
Srinivas
|
|
|
|
|
I have a bit of a problem trying to use a C++ class that contains virtual functions though C# p/invoke. Here is a trivial simplification of the problem to illustrate the issue.
With Visual Studio.Net 2003:
If I have a C++ class like so:
class ClassA
{
ClassA(){n = 0;}
int n;
void F(){n++;}
};
And an exported function that uses this class like so:
extern "C"
{
__declspec(dllexport) void ExportedFunc(ClassA** ppA)
{
ClassA* pA = *ppA;
pA->F();
}
}
I can call into this from C# by declaring a mapped structure for marshalling like so:
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
public class ClassA
{
int n;
}
And a function to wrap the exported C function:
class DLLImports
{
[DllImport("ExportFuncs.dll",
EntryPoint="ExportedFunc",
SetLastError=true,CharSet=CharSet.Unicode,
ExactSpelling=true,
CallingConvention=CallingConvention.StdCall)]
public static extern void ExportedFunc(ref ClassA refA);
}
I can then make a call into the dll containing the exported function like so:
{
.
.
ClassA refA = new classA();
DLLImports.ExportedFunc(ref refA);
.
.
}
Okay so this works a treat.
But if I now modify classA so this it contains a virtual function like so:
class ClassA
{
ClassA(){n = 0;}
virtual ~ClassA(){}
int n;
void F(){n++;}
};
We run into a problem. The C++ class ClassA now has an extra four bytes at the beginning to contain the vTable pointer. So this needs to be taken into account when creating the structure layout in C#. Now I have tried just putting a dummy four btyes in at the beginning and I have tried changing the class to LayoutKind.Explicit and
using the FieldOffset to offset the first item in the class by four bytes, but I still find that when the code gets into the C function the vtable pointer has been reset to null.
Is there a way to overcome the problem or is is simply a case of "don't use classes that contain a virtual function with p/invoke?
Regards
M
|
|
|
|
|
|
|
|
How 2 integate Pay Pal Pro in Asp.net (C#)
How 2 Use this..
plz help me Out..
Its Urgent
Viren
Never Think That You Have Failed Instead Always Think That u hav Better Chance Next Time...
|
|
|
|
|
Not wanting to be rude but 2 things first
1. Have you contacted paypal and asked them how to use their application, surely they would be the best place to start.
2. There is an ASP.Net forum for ASP.Net questions
Cheers
Kev
|
|
|
|
|
Hello Everyone,
I have developed a simple MDI forms application and am now stuck with a problem. I want to store the data of each childform in a seperate tag of an XML file. I have written a xml_write() method in the childform.cs but am not able to successfully write for each MDI childform.
Can I get some help!!
KR
|
|
|
|
|
You'll have to be more specific,
what happens when your write function is called?
are any exceptions thrown?
Maybe show some code??
If you don't give details then no one can help you
Kev
|
|
|
|
|
I have attached the code of the method I have written in the ChildForm.cs file but this is not the right code coz I am not able to append nodes to the XML file using this. My problem - I want to add a node with some text to the XML file whenever I open a new child window using normal MDI property.
private void Xml_Creation(int count)
{
XmlWrt = new XmlTextWriter("XMLSample.xml",null);
XmlWrt.Formatting=System.Xml.Formatting.Indented;
XmlWrt.WriteStartDocument();
//start the first element.
XmlWrt.WriteStartElement("FORMS");
//create our first customer element.
//this is a child element of the customers element.
XmlWrt.WriteStartElement("Form");
XmlWrt.WriteElementString("FormNumber", count.ToString()); XmlWrt.WriteEndElement();
//XmlWrt.WriteEndDocument();
//XmlWrt.Flush();
XmlWrt.Close();
}
Cheers
KR
|
|
|
|
|
Hello!
I have the following problem.
I've created windows service on MS Visual Studio 2005
and I am trying to install it using InstallUtil.exe which is in Framework 2.
I need to pass parameter to the executable file of the service.
I override method Install of my ServiceInstaller the following way:
public override void Install(IDictionary savedState)
{
Context.Parameters["assemblypath"] += " parameter";
base.Install(savedState);
}
When InstallUtil finishes working I have my installed service but in Executable File I have the value of Context.Parameters["assemblypath"] placed in double quotes:
"C:/.../myservices.exe parameter". When i try to start this service I have "File Not Found" exception. I replaced double quotes in regedit and service started normally.
The question: Is there any normal way to install service so that it wouldn't have double quotes, or the executable path would look like: "C:/.../myservices.exe" parameter.
Thank you for possible answers!
Dmitry Uvarov
|
|
|
|