Monday, March 26, 2012
trouble executing SP, SqlDbType.Bit...
This stored procedure fails because the variable type contains a number.
I've debugged the SP in VS2005 and it works if I change the 0/1 value of
type to true/false... How should I fix this' I cannot just replace type
with the phrase "false" or "true"... maybe using SqlDbType.Bit is wrong
This is header of this SP:
ALTER PROCEDURE dbo.DeleteMessage @dotnet.itags.org.id uniqueidentifier, @dotnet.itags.org.user int, @dotnet.itags.org.type
bit
Here is the ASP.NET code
public override void DeleteMessage(System.Guid id, int user, Boolean type)
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
SqlCommand cmd = new SqlCommand("SendMessage", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@dotnet.itags.org.id", SqlDbType.UniqueIdentifier).Value = id;
cmd.Parameters.Add("@dotnet.itags.org.user", SqlDbType.Int).Value = user;
cmd.Parameters.Add("@dotnet.itags.org.type", SqlDbType.Bit).Value = type;
}
}
any suggetions?
JeffIt says boolean, so you need to pass true (with no quotation marks) or false
-- for the value.
Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"Jeff" wrote:
> ASP.NET 2.0
> This stored procedure fails because the variable type contains a number.
> I've debugged the SP in VS2005 and it works if I change the 0/1 value of
> type to true/false... How should I fix this' I cannot just replace type
> with the phrase "false" or "true"... maybe using SqlDbType.Bit is wrong
> This is header of this SP:
> ALTER PROCEDURE dbo.DeleteMessage @.id uniqueidentifier, @.user int, @.type
> bit
> Here is the ASP.NET code
> public override void DeleteMessage(System.Guid id, int user, Boolean type)
> {
> using (SqlConnection cn = new SqlConnection(this.ConnectionString))
> {
> SqlCommand cmd = new SqlCommand("SendMessage", cn);
> cmd.CommandType = CommandType.StoredProcedure;
> cmd.Parameters.Add("@.id", SqlDbType.UniqueIdentifier).Value = id;
> cmd.Parameters.Add("@.user", SqlDbType.Int).Value = user;
> cmd.Parameters.Add("@.type", SqlDbType.Bit).Value = type;
> }
> }
> any suggetions?
> Jeff
>
>
trouble executing SP, SqlDbType.Bit...
This stored procedure fails because the variable type contains a number.
I've debugged the SP in VS2005 and it works if I change the 0/1 value of
type to true/false... How should I fix this?? I cannot just replace type
with the phrase "false" or "true"... maybe using SqlDbType.Bit is wrong
This is header of this SP:
ALTER PROCEDURE dbo.DeleteMessage @dotnet.itags.org.id uniqueidentifier, @dotnet.itags.org.user int, @dotnet.itags.org.type
bit
Here is the ASP.NET code
public override void DeleteMessage(System.Guid id, int user, Boolean type)
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
SqlCommand cmd = new SqlCommand("SendMessage", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@dotnet.itags.org.id", SqlDbType.UniqueIdentifier).Value = id;
cmd.Parameters.Add("@dotnet.itags.org.user", SqlDbType.Int).Value = user;
cmd.Parameters.Add("@dotnet.itags.org.type", SqlDbType.Bit).Value = type;
}
}
any suggetions?
JeffIt says boolean, so you need to pass true (with no quotation marks) or false
-- for the value.
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"Jeff" wrote:
Quote:
Originally Posted by
ASP.NET 2.0
>
This stored procedure fails because the variable type contains a number.
I've debugged the SP in VS2005 and it works if I change the 0/1 value of
type to true/false... How should I fix this?? I cannot just replace type
with the phrase "false" or "true"... maybe using SqlDbType.Bit is wrong
>
This is header of this SP:
ALTER PROCEDURE dbo.DeleteMessage @.id uniqueidentifier, @.user int, @.type
bit
>
Here is the ASP.NET code
public override void DeleteMessage(System.Guid id, int user, Boolean type)
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
SqlCommand cmd = new SqlCommand("SendMessage", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@.id", SqlDbType.UniqueIdentifier).Value = id;
cmd.Parameters.Add("@.user", SqlDbType.Int).Value = user;
cmd.Parameters.Add("@.type", SqlDbType.Bit).Value = type;
}
}
>
any suggetions?
>
Jeff
>
>
>
Saturday, March 24, 2012
trouble with an aspx page
My SO is w 2000 profesional and I have installed IIS.
thanks in advanceHi,
can you explain more specifically what you mean by "it doesn't work"?
when I open the file .aspx with the explorer I get the next message:
Error in execution
line 3
Error: Expected ';'
it happen openning all the aspx pages with webmatrix they work without trouble.
Thanks for your reply
Can you please show the code in question? Are you using C#? In that case, are you using "line terminator" (;) as it should be used?
How are you opening the page? Are you including localhost (eg http://localhost/test.aspx)?
My code is:
<%@. Page Language="VB" %>
<script runat="server"
Sub Button1_Click(sender As Object, e As EventArgs)
if TextBox1.text = "" then
msgbox("Nooo")
end if
Label1.text = " hola " & TextBox1.text & ". Buenos dÃas, la fecha es: " & Calendar1.selecteddate
TextBox1.text = ""
End SubSub Calendar1_Load(sender As Object, e As EventArgs)
dim hoy
hoy = Now
calendar1.selecteddate = hoy
End Sub</script>
<html>
<head>
</head>
<body>
<form runat="server">
<!-- Insert content here -->
<table style="WIDTH: 194px; HEIGHT: 170px">
<tbody>
<tr>
<td>
<asp:Label id="Label1" runat="server" width="123px">Label</asp:Label></td>
</tr>
<tr>
<td>
<asp:TextBox id="TextBox1" runat="server">Anto</asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Calendar id="Calendar1" runat="server" Width="232px" BackColor="White" DayNameFormat="FirstLetter" ForeColor="Black" Height="180px" Font-Size="8pt" Font-Names="Verdana" BorderColor="#999999" CellPadding="4" OnLoad="Calendar1_Load">
<TodayDayStyle forecolor="Black" backcolor="#CCCCCC"></TodayDayStyle>
<SelectorStyle backcolor="#CCCCCC"></SelectorStyle>
<NextPrevStyle verticalalign="Bottom"></NextPrevStyle>
<DayHeaderStyle font-size="7pt" font-bold="True" backcolor="#CCCCCC"></DayHeaderStyle>
<SelectedDayStyle font-bold="True" forecolor="White" backcolor="#666666"></SelectedDayStyle>
<TitleStyle font-bold="True" bordercolor="Black" backcolor="#999999"></TitleStyle>
<WeekendDayStyle backcolor="#FFFFCC"></WeekendDayStyle>
<OtherMonthDayStyle forecolor="Gray"></OtherMonthDayStyle>
</asp:Calendar>
</td>
</tr>
<tr>
<td>
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Button"></asp:Button>
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
I don't think that your code is the issue here (although you can't use msgbox in ASP.NET - it's JavaScript) as it has been working in WebMatrix. In order for the script to be processed you need to type http://localhost/[filename].aspx in the address bar. Are you doing this?
No ,
I open webmatrix
open myfile.aspx
menu wiev F5
I choose the option : Use Asp Webmatrix Server Port 8080 and it works
when the another options it don´t work gives the error .
In your first post you said that it didn't work when you open it in [internet] explorer. I don't know what the options are (in WebMatrix), but it sounds like there isn't really a problem - you need to use Port 8080 to use HTTP.