|
labdakos wrote: Integrated Security=True
I would start by looking at the integrated security. When set to true the currently logged in windows user account will be used to try to access the server. If you haven't given the individual accounts permission to the database security could be stopping you.
You could fix this by setting the integrated security to false and then specifying a specific SQL UserID and password.
Latest toy built for fun: Web Lens
Best feature: Full size images when using Google image search.
|
|
|
|
|
Also doesn't look like you are specifying your server name in the connection string. SQL will only have to be installed on your server but the other machines need to know where that is.
This is a pretty good primer on connection strings: http://www.connectionstrings.com/sql-server-2005[^]
Latest toy built for fun: Web Lens
Best feature: Full size images when using Google image search.
|
|
|
|
|
Hello all i have the following structure of an XML documet:
<br />
<?xml version="1.0" encoding="utf-8" ?><br />
<config><br />
<Item><br />
<relais>255</relais><br />
<tijdIn>12:00</tijdIn><br />
<tijdUit>13:00</tijdUit><br />
</Item><br />
<Item><br />
<relais>255</relais><br />
<tijdIn>12:00</tijdIn><br />
<tijdUit>13:00</tijdUit><br />
</Item><br />
</config><br />
i need a (c#) code to read to document and load the items: Relais, TijdIn and Tijd uit in a different collum in a datagridview.
Because im new to XML i need your help! thank You!
|
|
|
|
|
|
I have written code to export content of DatagridView to Excel using Strem. It works but in some case some texts are found missing. And Numeric Datas are not formatted(i.e. while adding or calculating from exported data, unable to perform calculation. My code is like this:
public class ExcelReport
{
#region
private string Heading1;
private DataGridView Grid;
private int ReportType;
private int StartCol = 0;
private int StartRow = 0;
#endregion
#region Constructors
/// <summary>
/// Report Type:Excel=1,HTML=2,Word=3 and All=4
/// </summary>
/// <param name="_heading1"></param>
/// <param name="_grid"></param>
public ExcelReport(string _heading1,int _reportType, DataGridView _grid)
{
this.Heading1 = _heading1;
this.ReportType = _reportType;
this.Grid = _grid;
WriteReport();
}
#endregion
#region Main Function For Exporting
private void WriteReport()
{
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
if (ReportType == 1)
{
saveFileDialog1.Filter = "Excel Worksheet files|*.xls";
}
else if (ReportType == 2)
{
saveFileDialog1.Filter = "HTML Files|*.htm";
}
else if (ReportType == 3)
{
saveFileDialog1.Filter = "Word Files|*.doc";
}
else if (ReportType == 4)
{
saveFileDialog1.Filter = "Excel Worksheet files|*.xls|HTML Files|*.html|Word Files|*.doc|All Files|*.*";
}
//Exporting To Different Formates using Stream
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
FileInfo fi = new FileInfo(saveFileDialog1.FileName);
StreamWriter sw = fi.CreateText();
sw.WriteLine("<table bgcolor='#FFFFFF' border=1 width='100%'>");
sw.Write("<tr>");
foreach (DataGridViewColumn col in Grid.Columns)
{
string FontName;
if (Grid.ColumnHeadersDefaultCellStyle.Font.Name.ToString() != null)
{
FontName = Grid.ColumnHeadersDefaultCellStyle.Font.Name.ToString();
}
else
{
FontName = col.DefaultCellStyle.Font.Name.ToString();
}
sw.Write("<th bgcolor='#ECE9D8'><FONT FACE='" + FontName + "'>" +ReplaceSpclChars(col.HeaderText) + "</font></th>");
}
sw.Write("</tr>");
//Fills cells of excel sheet by the content of grid view
int i=0;
for (i = 0; i < Grid.Rows.Count; i++)
{
sw.Write("<tr>");
for (int j = 0; j < Grid.Columns.Count; j++)
{
string FontName;
if (Grid.Columns[j].DefaultCellStyle.Font != null)
{
FontName = Grid.Columns[j].DefaultCellStyle.Font.Name.ToString();
}
else
{
FontName = Grid.DefaultCellStyle.Font.Name.ToString();
}
if (Grid[j, i].Value != null)
{
sw.Write("<td><FONT FACE='" + FontName + "'>" + ReplaceSpclChars(Grid[j, i].Value.ToString()) + "</font></td>");
}
else
{
sw.Write("<td><FONT FACE='" + FontName + "'>" + Grid[j, i].Value + "</font></td>");
}
}
sw.Write("</tr>");
}
sw.WriteLine("<b><Font Face='Shangrila Numeric' size='14px'>" + ReplaceSpclChars(Heading1)+ "</Font></b>\n");
sw.WriteLine("</table>");
sw.Close();
if (i > 1)
{
CrudeFx.MsgBoxNepali.Show(@";""rL PS;]ndf n}hfg] sfd ;DkGg eof] M", MessageBoxButtons.OK);
}
}
#endregion
}
private string ReplaceSpclChars(string fieldName)
{
fieldName = fieldName.Replace("<", "<");
fieldName = fieldName.Replace(">", ">");
return fieldName;
}
}
|
|
|
|
|
|
Thank you very much for your reply.
|
|
|
|
|
Hi all...
I'm trying to write to a file with the XmlDocument class. I used the Save(string) method which gets a file location and saves the XML to it. the thing is I get an exception:
"The process cannot access the file 'c:\scene.xml' because it is being used by another process".
What is the problem? how can I overcome this? (I want to load the file and then to be able to save on the that file)
some code:
this happens when loading of the file
_currentXMLFile = openXMLFileDialog1.FileName;
System.IO.StreamReader myXMLFileStream = new System.IO.StreamReader(_currentXMLFile);
XmlTextReader myXMLTextReader = new System.Xml.XmlTextReader(myXMLFileStream);
_myXMLDocument = new System.Xml.XmlDocument();
_myXMLDocument.Load(myXMLTextReader);
myXMLDocument is defined at the start of the program so it will have the program's lifespan.
this happens when trying to save the XML document into a file, and throws an exception:
myXMLDocument.Save(fileName);
|
|
|
|
|
Hi,
if you're running Windows Vista or higher, you are not authorized to create files in certain locations of your boot partition; the top level directory is one of them. So choose another location, there is an excellent way to get some here: Environment.GetFolderPath() Depending on the kind of file and data, look for ApplicationData or MyDocuments or ...
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Actually I'm using windows XP...
I tried the procedure (load and save) on many locations and it still throws the error.
it there a way to load and save the same file, did any one tried that??
|
|
|
|
|
Make sure you close the file where you load it, the "another process" part of the error message often is incorrect.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
ok, even though the System.IO.StreamReader is defined within a function?? (the function ends before the save action)
|
|
|
|
|
yes, you have to close or dispose of it explicitly, or use a using statement which is a way to get it disposed of automatically. There is no "stack semantics" stuff in C#, and the GC will only execute finalizers if and when new memory allocations cannot be satisfied without collecting first (and even then finalizers run on a low-priority thread), so that can take a long time to happen.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Closing the streamReader did solve the problem... you are awesome!
one more question on a relative topic:
XMLNode myXmlNode;
for (int i=0; i < 2; i++)
{
myXmlNode = new XMLNode;
}
will the GC collect the first two allocations of the XMLNode? and when?
|
|
|
|
|
Hi,
you have to add () to make that compile...
and I see only two allocations. The first is collectible right away, as the only reference (in myXmlNode) gets overwritten by the second one; I can't see where the second one becomes collectible, as the enclosing code block is absent.
And collectible isn't the same as collected, as I already explained.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Can I get the code of any *.exe file?? If yes how?
because I lost my source code for my application. But I installed it before it is lost ... and I have the exe file with me ....... what do u recommend me to do??
|
|
|
|
|
Sure, get Red Gate's Reflector (previously from Lutz Roeder), for native programs, well, there is a thing called Boomerang, but it is not that good so you'd be better off with a disassembler for native code.
|
|
|
|
|
IMO, given your previous posts it's doubtful you want this for genuine purposes. It's more likely you want to decompile someone else's application, and, again from your previous posts, it's highly unlikely you would even understand it.
If this is not the case, then it's a good lesson for you in how to use source control and backups.
only two letters away from being an asset
|
|
|
|
|
hey dude ..... that is not the case .... i didnt know that exe files will be converted to back ..... after I know it(i.e yesterday) I remembered there was one application that I did for my customer and I remembered I lost it with virus ...... but the exe file is still on my pc .... that is why i post this question... if you can help am here...
Thank you
|
|
|
|
|
Hey dude...then it's a good lesson for you in how to use source control and backups.
only two letters away from being an asset
|
|
|
|
|
you omitted too many periods to make that sink in I'm afraid.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
why dont u say ..... I cant... i think it hard 4 u to say that
|
|
|
|
|
Hello,
How l can make a form to blink (after some event occured)?
10x alot
|
|
|
|
|
It's not a question of how, but why. IMO, it would be a horrendous UI.
only two letters away from being an asset
|
|
|
|
|
I think he means, "flash the title bar", ala Windows Messenger, not "a form that blinks on and off".
Religiously blogging on the intarwebs since the early 21st century: Kineti L'Tziyon
Judah Himango
|
|
|
|