Monday, March 26, 2012
Escaped URI
I have a valid and working template which takes 2 parameters and can be accessed
using a URI of the form
http://localhost/dbports/template/tm...65&AddrID=3084
However when I try to include this information in an XSLT transformation using the
document() function it escapes the & in the URIstring to & and accessing the
template using
http://localhost/dbports/template/tm...mp;AddrID=3084
doesn't seem to work. It just returns the following HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>
This must be something simple mustn't it ? Any ideas ?
TIA
Feargal Hogan
Can you please forward the code fragment that does the invocation? Is that
the argument to the document() function or the output of the XSLT that you
then send over HTTP?
Thanks
Michael
"Feargal Hogan" <feargalhNO@.Spam.portinfo.co.uk> wrote in message
news:uVRIGc6rEHA.1232@.TK2MSFTNGP11.phx.gbl...
> Hi
> I have a valid and working template which takes 2 parameters and can be
> accessed
> using a URI of the form
> http://localhost/dbports/template/tm...65&AddrID=3084
> However when I try to include this information in an XSLT transformation
> using the
> document() function it escapes the & in the URIstring to & and
> accessing the
> template using
> http://localhost/dbports/template/tm...mp;AddrID=3084
> doesn't seem to work. It just returns the following HTML
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META http-equiv=Content-Type content="text/html;
> charset=windows-1252"></HEAD>
> <BODY></BODY></HTML>
> This must be something simple mustn't it ? Any ideas ?
> TIA
> Feargal Hogan
>
|||Michael
Thanks. I figured out the problem. I just set disable-output-escaping in
"<xsl:value-of " element
Feargal
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
news:OcFfI2HsEHA.2136@.TK2MSFTNGP14.phx.gbl...
> Can you please forward the code fragment that does the invocation? Is that
> the argument to the document() function or the output of the XSLT that you
> then send over HTTP?
> Thanks
> Michael
> "Feargal Hogan" <feargalhNO@.Spam.portinfo.co.uk> wrote in message
> news:uVRIGc6rEHA.1232@.TK2MSFTNGP11.phx.gbl...
>
Wednesday, March 7, 2012
Error1'System.Net.NetworkCredential' is a 'type', which is not valid in the given contextC:\
Hello, I got this error when trying to render, in the line of the credentials, how should I solve it.
rs.Credentials = System.Net.NetworkCredential("levalencia", "123", "se");
ReportingService2005 rs;
private void cargarReporteFromWS()
{
rs = new ReportingService2005();
rs.Credentials = System.Net.NetworkCredential("levalencia", "123123123", "se");
}
Hello,System.Net.NetworkCredential is not a static method, but a constructor, so you need to use the "new" keyword.
rs.Credentials = new System.Net.NetworkCredential("levalencia", "123", "se");
Sunday, February 26, 2012
error:the string was not recognized as a valid DateTime.
hi all, i'm trying to insert the time/date a button was clicked on a gridview and it generates an error:the string was not recognized as a valid DateTime.There is an unknown word starting at index 0 i have changed the culture to en-US but it still doesn't work. i actually created the date/time column after some data had been entered into the table so the column allows nulls. this is my code:
InsertCommand="INSERT INTO test101(Surname,Names,Registration,Login Time)VALUES (@.Surname, @.Names, @.Registration,@.Login_Time)"
<Insert Parameters><asp:Parameter DefaultValue= DateTime.Now Type=DateTime Name="Login_Time" /></Insert Parameters
any suggestions?
When do you recieve that error? You mentioned button on a GridView, so I suppose that you're trying to update some values and, if that's the case, use this code:
If, on the other hand, you're trying to insert some values in database, use this code (this is example for inserting values with DetailsView ):protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
e.NewValues["Login_Time"] = DateTime.Now;
}
|||protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
e.Values["Login_Time"] = DateTime.Now;
}
sorry, this message was supposed to be:
hi all, i'm trying to insert the time/date at the time a user clicks the submit button but it generates an error:the string was not recognized as a valid DateTime.There is an unknown word starting at index 0 i have changed the culture to en-US but it still doesn't work. this is my code:
InsertCommand="INSERT INTO test101(Surname,Names,Registration,Login Time)VALUES (@.Surname, @.Names, @.Registration,@.Login_Time)"
<Insert Parameters><asp:Parameter DefaultValue= DateTime.Now Type=DateTime Name="Login_Time" /></Insert Parameters
any suggestions?
Where is that submit button (in DetailsView or in FormView)?
|||it's on a login page. so i want the time the user logged on to be saved on a database
|||Can you post your whole code?
|||One way to achieve your goal is to change your InsertParameter into this:
and put this in Page_Load event:<Insert Parameters><asp:Parameter Type="DateTime" Name="Login_Time" /></Insert Parameters>
|||<asp:ButtonID="login1"runat="server"Text="Login"SqlDataSource1.InsertParameters["Login_Time"].DefaultValue = DateTime.Now.ToString();
Height="31px"OnClick="login1_Click"Width="65px"BackColor="#E0E0E0"Font-Size="Medium"/>
<asp:ButtonID="Reset1"runat="server"BackColor="#E0E0E0"Font-Size="Medium"
Height="32px"OnClick="Reset1_Click"Text="Reset"Width="63px"/>
<br/>
<br/>
<asp:SqlDataSourceID="SqlDataSource1"runat="server"
ConnectionString="<%$ ConnectionStrings:engineeringConnectionString %>"
InsertCommand="INSERT INTO test101(Surname,Names,Registration,[Course code],[Login Time]) VALUES (@.Surname,@.Names,@.Registration,@.Course_code,@.Login_Time)">
<InsertParameters>
<asp:ControlParameterControlID="TextBox1"DefaultValue="Textbox1.Text"Name="Surname"
PropertyName="Text"/>
<asp:ControlParameterControlID="TextBox2"DefaultValue="TextBox2.Text"Name="Names"
PropertyName="Text"/>
<asp:ControlParameterControlID="TextBox3"DefaultValue="TextBox3.Text"Name="Registration"
PropertyName="Text"/>
<asp:ControlParameterControlID="TextBox4"DefaultValue="TextBox4.Text"Name="Course_code"
PropertyName="Text"/>
<asp:Parameter Name="Login_Time" type=DateTime/>
</InsertParameters>
</asp:SqlDataSource>
<asp:GridViewID="GridView1"
runat="server"AutoGenerateColumns="False"AutoGenerateDeleteButton="True"DataKeyNames="ID"
AutoGenerateEditButton="True"AllowSorting="True"BackColor="LightGoldenrodYellow"BorderColor="Tan"BorderWidth="1px"CellPadding="2"ForeColor="Black"GridLines="None"PageSize="20"Height="374px"EmptyDataText="null"DataSourceID=SqlDataSource1Visible="False"AllowPaging="True">
<Columns>
<asp:BoundFieldDataField="ID"HeaderText="ID"InsertVisible="False"ReadOnly="True"
SortExpression="ID"/>
<asp:BoundFieldDataField="Surname"HeaderText="Surname"SortExpression="Surname"/>
<asp:BoundFieldDataField="Names"HeaderText="Names"SortExpression="Names"/>
<asp:BoundFieldDataField="Registration"HeaderText="Registration"SortExpression="Registration"/>
<asp:BoundFieldDataField="Course code"HeaderText="Course code"SortExpression="Course code"/>
<asp:BoundFieldDataField="Grade"HeaderText="Grade"SortExpression="Grade"/>
<asp:BoundFieldDataField="login Time"HeaderText="Login Time"SortExpression="login Time"/>
</Columns>
</asp:GridView>
and this is the code behind:
protectedvoid Page_Load(object sender,EventArgs e){
SqlConnection conn =newSqlConnection("Data Source=(local);Initial Catalog=engineering; Integrated Security=True");
conn.Open();
GridView1.DataBind();
conn.Close();
}
publicvoid login1_Click(object sender,EventArgs e)
{
SqlDataSource1.Insert();
if (TextBox1.Text !="" && TextBox2.Text !="" && TextBox3.Text !="" && TextBox4.Text !=""){
Response.Redirect("test1.aspx");}
|||Just add SqlDataSource1.InsertParameters["Login_Time"].DefaultValue = DateTime.Now.ToString(); in login1_Click event like this:
And one question: Why are you opening connection in Page_Load event?:public void login1_Click(object sender, EventArgs e)
{
SqlDataSource1.InsertParameters["Login_Time"].DefaultValue = DateTime.Now.ToString();
SqlDataSource1.Insert();
if (TextBox1.Text != "" && TextBox2.Text != "" && TextBox3.Text != "" && TextBox4.Text !="")
{
Response.Redirect("test1.aspx");
}
If you're using SqlDataSource this is unnecessarily.|||SqlConnection conn = new SqlConnection("Data Source=(local);Initial Catalog=engineering; Integrated Security=True");
conn.Open();
GridView1.DataBind();
conn.Close();
THANK YOU SO MUCH!!!!!
Friday, February 24, 2012
error:25 - connection string is not valid
I have installed SQL Server 2005 Developer edition. When I open SQL Server Management Studio, and try to connect to the database engine, I enter these credentials:
Server name: LT2000\MSSQLSERVER
Login: sa
Password: my password
When I try to connect I receive the following error:
An error has occured while trying to establish a connection to the server. When connecting to SQL server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.(provider: sql network interfaces, error:25 - connection string is not valid)(Microsoft SQL Server, Error:87)
What can I do?
Peter Smith:
I have installed SQL Server 2005 Developer edition. When I open SQL Server Management Studio, and try to connect to the database engine, I enter these credentials:
What can I do?
I don't understand what you mean by connecting to the database engine because I have not had the need for that in 8years plus using SQL Server, but your error means you are trying to connect with only named pipes you need to use both named pipes and TCP/IP. Then enable remote connection that is covered by Microsoft below. Hope this helps.
http://blogs.msdn.com/sqlexpress/archive/2005/05/05/415084.aspx
http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277
|||The surface area configuration tool used to configure SQL Serve 2005 check the doc below remote connection.
http://msdn2.microsoft.com/en-us/library/ms178763.aspx
|||Actually the error has nothing to do with pipes. If you look in the error message you find the message "error:25 - connection string is not valid", that is the error. If you are sure those are that is your valid credential you should use a connection string just like this one: "Data Source=LT2000\MSSQLSERVER;Initial Catalog=Northwind;User ID=sa;Password=mypassword"; Initial catalog is of course the name of your database. If that doesn't work, then use a data source wizard and enter your credentials, then test the connection and see if it works. If it doesn't you probably have wrong credentials. You can try also using the Windows Authentication('cause you set your sql server to user mixed authentication mode), in that way your connection string will be: "Data Source=LT2000\MSSQLSERVER;Initial Catalog=Northwind;Integrated Security=true".
Tell us if that works for you.
|||
Hi,
When I use MS SQL Management Studio and I want to connect, I get to see a dropdown...in this dropdown I can select "database engine".
I then fill in the type of authentication (sql server in this case), and I can log on.
I dont have the problem anymore, but that might be that out of frustration I just reinstalled SQL Server...it works fine now :)