Click here to Skip to main content
15,891,567 members
Home / Discussions / C#
   

C#

 
AnswerRe: Disable TextBox cursor Pin
Luis Alonso Ramos12-Feb-07 17:42
Luis Alonso Ramos12-Feb-07 17:42 
GeneralRe: Disable TextBox cursor Pin
bankai12312-Feb-07 17:54
bankai12312-Feb-07 17:54 
Questionhow to fix a menustrip ? Pin
test12345012-Feb-07 13:53
test12345012-Feb-07 13:53 
AnswerRe: how to fix a menustrip ? Pin
ShermansLagoon12-Feb-07 23:16
ShermansLagoon12-Feb-07 23:16 
QuestionRe: how to fix a menustrip ? Pin
test12345013-Feb-07 2:46
test12345013-Feb-07 2:46 
AnswerRe: how to fix a menustrip ? Pin
ShermansLagoon13-Feb-07 7:13
ShermansLagoon13-Feb-07 7:13 
Question.NET 2.0 UserControl Adorners Override Please Help!! Pin
@FrankDrebin@12-Feb-07 12:56
@FrankDrebin@12-Feb-07 12:56 
QuestionHow to set node value in XMLDocument [modified] Pin
AndrusM12-Feb-07 12:51
AndrusM12-Feb-07 12:51 
I have XML file embedded in my C# Winforms application.
I need to add data to <pre><ConnectString></ConnectString></pre>
element so it looks like

<pre><ConnectString>database=mydb;server=localhost;user=myuser</ConnectString></pre>

and return it as string. I created the following method.
Which XmlDocument function I should use to add data to ConnectString node ?

<pre>string GetDefaultReport(string connectionString) {

Stream stream = GetType().Assembly.GetManifestResourceStream
("mynamespace.DefaultReport.xml");
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(stream);
// todo: replace <ConnectString></ConnectString>
// with <ConnectString> connectionString value </ConnectString>
return xmlDocument.InnerXml;
}<pre>

xml file looks as follows:

<pre><?xml version='1.0' encoding='utf-8'?>
<Report xmlns='http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition'
xmlns:rd='http://schemas.microsoft.com/SQLServer/reporting/reportdesigner'>

<DataElementStyle>ElementNormal</DataElementStyle>
<RightMargin>0.25in</RightMargin>
<Body>
<ReportItems>
<List Name='list1'>
<DataInstanceName>Row</DataInstanceName>
<NoRows>Selliseid andmeid pole</NoRows>
<Style />
<DataSetName>Data</DataSetName>
<ReportItems>
<Textbox Name='Algus'>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>1</ZIndex>
<CanGrow>false</CanGrow>
<Value>=Fields!akuupaev</Value>
<Width>1in</Width>
<Height>14pt</Height>
</Textbox>
<Textbox Name='Lõpp'>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<Left>1.5in</Left>
<Width>1.5in</Width>
<Height>14pt</Height>
<CanGrow>false</CanGrow>
<Value>=Fields!lkuupaev</Value>
</Textbox>
</ReportItems>
</List>
</ReportItems>
<Style />
<Height>0.25in</Height>
<ColumnSpacing>0.25in</ColumnSpacing>
<Columns>1</Columns>
</Body>
<TopMargin>0.5in</TopMargin><DataSources>

<DataSource Name='DS1'>
<ConnectionProperties>
<DataProvider>PostgreSQL</DataProvider>
<ConnectString></ConnectString>
</ConnectionProperties>
</DataSource>
</DataSources>

<DataSets>
<DataSet Name='Data'>
<Query> <DataSourceName>DS1</DataSourceName>
<CommandText>SELECT akuupaev,lkuupaev FROM {1}.kontekst</CommandText>
</Query>
<Fields>
<Field Name='akuupaev'>
<DataField>akuupaev</DataField>
<rd:TypeName>System.DateTime</rd:TypeName>
</Field>
<Field Name='lkuupaev'>
<DataField>lkuupaev</DataField>
<rd:TypeName>System.DateTime</rd:TypeName>
</Field>
</Fields>
</DataSet>
</DataSets>

<LeftMargin>0.25in</LeftMargin>
<BottomMargin>0.5in</BottomMargin>
<Width>2.5in</Width>

<PageHeader>
<Height>22.8pt</Height>
<ReportItems>
<Textbox Name='lehepealkiri'>
<Height>12pt</Height>
<Width>5in</Width>
<Value>{2}</Value>
<Left>30.9pt</Left>
<Top>5.8pt</Top>
</Textbox>
</ReportItems>
<PrintOnFirstPage >true</PrintOnFirstPage>
<PrintOnLastPage >true</PrintOnLastPage>
</PageHeader>

<PageFooter>
<Height>0pt</Height>
</PageFooter>
</Report>
</pre>



-- modified at 18:56 Monday 12th February, 2007

Andrus
AnswerRe: How to set node value in XMLDocument Pin
gauthee12-Feb-07 17:01
gauthee12-Feb-07 17:01 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM13-Feb-07 1:50
AndrusM13-Feb-07 1:50 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz13-Feb-07 6:19
Stefan Troschuetz13-Feb-07 6:19 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM13-Feb-07 8:48
AndrusM13-Feb-07 8:48 
GeneralRe: How to set node value in XMLDocument [modified] Pin
Stefan Troschuetz13-Feb-07 9:19
Stefan Troschuetz13-Feb-07 9:19 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM14-Feb-07 6:18
AndrusM14-Feb-07 6:18 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz14-Feb-07 7:36
Stefan Troschuetz14-Feb-07 7:36 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM14-Feb-07 9:23
AndrusM14-Feb-07 9:23 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz14-Feb-07 9:59
Stefan Troschuetz14-Feb-07 9:59 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM14-Feb-07 10:23
AndrusM14-Feb-07 10:23 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz14-Feb-07 21:13
Stefan Troschuetz14-Feb-07 21:13 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM15-Feb-07 6:43
AndrusM15-Feb-07 6:43 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz15-Feb-07 7:32
Stefan Troschuetz15-Feb-07 7:32 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM15-Feb-07 8:13
AndrusM15-Feb-07 8:13 
QuestionConvert DataReader to Entity list Pin
AndrusM12-Feb-07 12:49
AndrusM12-Feb-07 12:49 
QuestionCrystal Report WebService Report to DataSet Pin
dbambirck12-Feb-07 12:36
dbambirck12-Feb-07 12:36 
QuestionCopy value from that table adapter to data grid cell, how? Pin
TrooperIronMan12-Feb-07 12:33
TrooperIronMan12-Feb-07 12:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.