Showing posts with label aspnet. Show all posts
Showing posts with label aspnet. Show all posts

Wednesday, March 21, 2012

problem with a date parameter in ASP.Net page

The date format in the 'weekending' textbox is 5/5/2007
Here's what I've got:

With cmd.Parameters
.Add(New SqlParameter("@.SQLweekending", SqlDbType.DateTime,weekending.Text))
the error message is:
"Conversion from string "4/8/2007" to type 'Integer' is not valid."

Then, I tried:
.Add(

New SqlParameter("@.SQLweekending", SqlDbType.DateTime,CDate(weekending.Text)))

but, before I even tried it, it gave me a blue squiggly line, with an error message:
"Error 2 Value of type 'Date' cannot be converted to 'Integer'"

How can I get this to work?

Hi,

What is the data type for yourSQLweekending column in your table? Is it a DateTime column or Integer type? You need a DateTime column for this.

|||Nope - it's datetime also|||

Here is sample in VB.NET that inserts date to a datetime column:

Dim MySQLAsString ="Insert into Dates (id, tDate) values (@.id, @.tDate)"Dim myConnAs SqlConnection =New SqlConnection(ConfigurationManager.ConnectionStrings("forumConnectionString").ConnectionString.ToString())Dim CmdAsNew SQLCommand(MySQL, MyConn)

Cmd.Parameters.Add(

New SqlParameter("@.id", txtid.Text))

Cmd.Parameters.Add(

New SqlParameter("@.tDate",txttDate.Text))

MyConn.Open()

cmd.ExecuteNonQuery()

MyConn.Close()sql

Monday, March 12, 2012

Problem when trying to deploy a web site built with asp.net 2.0 and using SQL EXPRESS

Hi,

Plz help!

I built a web site using IIS and ASP.NET 2.0.

My web site has a log on screen and I only configured it with one user without any roles. This web site uses the SQL EXPRESS.(I Have 2 databases: 1 for the security required by the application and the other for my application. for the connectionstring I used a windows authentication security with an instance = true.)

Everything went well on my PC.

When I tried to deploy the web site on another PC, there was a big problem.

When I tried to login with the same user I created, then I have a problem.

The password is incorrect(Why? I don't know).

Maybe there is a problem with the IIS or with the SQL SERVER.

pLZ HELP!!

You should take a look at the forum at http://forums.asp.net/54/ShowForum.aspx, which covers Visual Web Designer. They will have a better idea how to address this.

Mike

Problem when passing parameter to Execute SQL Task

Hi!

I have a execute sql task to create and drop logins. I want to create/drop the ASPNET login, but I need to pass the domain using a parameter. So I mapped a parameter:

Variable name: User::serverName

Direction: Input

DataType: Varchar

Parameter Name:0

and the sql is the following:

CREATE LOGIN [?\ASPNET] FROM WINDOWS

But I get the error:

Executing the query "CREATE LOGIN [?\ASPNET] FROM WINDOWS failed with the following error: "Windows NT user or group '?\ASPNET' not found. Check the name again.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

What am I doing wrong?

Thank you!

Did you set the "BypassPrepare" to True on the execute task? That gets me every time I use variables.

If you don't set that, it treats the ? as a literal and fails.|||

Hi!

Yes, BypassPrepare is set to true...

Thank you!

|||Setup another variable to hold your full string so that in your SQL you only have the ? placeholder instead of ?/ASPNET.

So, in my test, I created a new variable, set its expression to concatenate the User::ServerName variable and the /ASPNET string. Set the new variable to EvaluateAsExpression and then use it in the parameter mapping of the ExecuteSQL task.

Does that do what you're looking for?|||

Hi!

I tried what you suggest and I still have the error... Then I tried something simpler, CREATE LOGIN ? WITH PASSWORD = 'lalala', and I got the following error:

Executing the query "CREATE LOGIN ? WITH PASSWORD = 'lalala'" failed with the following error: "Syntax error, permission violation, or other nonspecific error". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

And if I change it to CREATE LOGIN test WITH PASSWORD = 'lalala' it works fine, so I guess it's not a connection problem. I guess I'm missing something silly!

Thank you!

|||What type of connection are you using? OLE DB, ADO, ADO.NET, ODBC, etc..

The connection type that you use will dictate how you name the parameter and then use a parameter in your SQL.|||http://sqljunkies.com/WebLog/knight_reign/archive/2005/10/05/17016.aspx|||

I'm using an OLE DB connection, and it seems the parameter name is ok... Posting the code would help?

Thank you!

|||I have a variable (User::Test) set as a string with a value of "P0160".

In the Execute SQL Task editor, my sql statement is:
update client set clientdesc = 'testing' where client = ?

Then, in the parameter mapping section, I added a variable and selected User::Test as the variable name. Its data type is VARCHAR. The Parameter Name is simply, 0.

That's it. I run the task and it works correctly.|||It works now. Thank you very much for you help!

Saturday, February 25, 2012

Problem using SQL 2005 Reporting Services & asp.net app

I'm using VS 2005, SQL 2005 reporting services.
SQL reporting services is working, and I have it both on my local
computer, as well as on a server.
I've created a report in the SQL Business Intelligence development
studio that works in that environment.
I've uploaded the same report to both the Reporting services on my local
computer as well as the server, and can log in to them and run the
report there.
In VS 2005, in a test application that otherwise functions, I brought in
a Reportviewer from the toolbar, and added the report to it.
The reportServerUrl is:
http://mylocalcomputer/reports$sql2005
(I have both sql 2000 and sql 2005 on this local box).
The report path is:
J4 Report/J4 Detail Report
When I try to run it, I get:
The attempt to connect to the report server failed. Check your
connection information and that the report server is a compatible version.
The request failed with HTTP status 404: Not Found.
When I change the server name to the other one, I get the same message.
However, when I go into SQL Server Reporting services, to this link:
http://myserver/Reports$SQL2005/Pages/Report.aspx?ItemPath=%2fJ4+reports%2fJ4+Detail+Report
The report displays fine.
When I go to my local computer & sql reporting services, to this link:
http://mylocalcomputer/Reports$SQL2005/Pages/Report.aspx?ItemPath=%2fJ4+Reports%2fJ4+Detail+Report
I'm not using Localhost either in the VS 2005 app (in the properties for
the report viewer), but I am calling it (the web app itself where I'm
trying to call the report viewer from) thru localhost there.
http://localhost:2228/testjob/default.aspx
I'm calling other things (not report viewers) on this page that appear
to work.
I've seen some notes regarding this error, and that there is a lot of
registry hacks and config file updates you have to make for it, but not
sure if that's a true fix for the problem.
Anyone have any idea why SQL Reporting Services displays it fine, and
the report viewer - which is supposedly calling the same thing, doesn't?
BCOn Jul 27, 9:16 am, Blasting Cap <goo...@.christian.net> wrote:
> I'm using VS 2005, SQL 2005 reporting services.
> SQL reporting services is working, and I have it both on my local
> computer, as well as on a server.
> I've created a report in the SQL Business Intelligence development
> studio that works in that environment.
> I've uploaded the same report to both the Reporting services on my local
> computer as well as the server, and can log in to them and run the
> report there.
> In VS 2005, in a test application that otherwise functions, I brought in
> a Reportviewer from the toolbar, and added the report to it.
> The reportServerUrl is:
> http://mylocalcomputer/reports$sql2005
> (I have both sql 2000 and sql 2005 on this local box).
> The report path is:
> J4 Report/J4 Detail Report
> When I try to run it, I get:
> The attempt to connect to the report server failed. Check your
> connection information and that the report server is a compatible version.
> The request failed with HTTP status 404: Not Found.
> When I change the server name to the other one, I get the same message.
> However, when I go into SQL Server Reporting services, to this link:
> http://myserver/Reports$SQL2005/Pages/Report.aspx?ItemPath=%2fJ4+repo...
> The report displays fine.
> When I go to my local computer & sql reporting services, to this link:
> http://mylocalcomputer/Reports$SQL2005/Pages/Report.aspx?ItemPath=%2f...
> I'm not using Localhost either in the VS 2005 app (in the properties for
> the report viewer), but I am calling it (the web app itself where I'm
> trying to call the report viewer from) thru localhost there.
> http://localhost:2228/testjob/default.aspx
> I'm calling other things (not report viewers) on this page that appear
> to work.
> I've seen some notes regarding this error, and that there is a lot of
> registry hacks and config file updates you have to make for it, but not
> sure if that's a true fix for the problem.
> Anyone have any idea why SQL Reporting Services displays it fine, and
> the report viewer - which is supposedly calling the same thing, doesn't?
> BC
This might be a long shot, but you should check to see if the the
virtual directories (ReportServer and Reports) in IIS are set to the
correct .NET Framework (.NET 2.0) [via: right-click My Computer ->
select Manage -> Services and Applications -> Internet Information
Services -> Web Sites -> Default Web Site -> right-click the Reports/
ReportServer virtual directories -> select Properties -> select the
ASP.NET tab and verify that the ASP.NET version is 2.0.50727]. Hope
this helps.
Regards,
Enrique Martinez
Sr. Software Consultant|||Connect to ReportServer instead of Reports...i.e.
http://mylocalcomputer/ReportServer$sql2005
"Blasting Cap" wrote:
> I'm using VS 2005, SQL 2005 reporting services.
> SQL reporting services is working, and I have it both on my local
> computer, as well as on a server.
> I've created a report in the SQL Business Intelligence development
> studio that works in that environment.
> I've uploaded the same report to both the Reporting services on my local
> computer as well as the server, and can log in to them and run the
> report there.
> In VS 2005, in a test application that otherwise functions, I brought in
> a Reportviewer from the toolbar, and added the report to it.
> The reportServerUrl is:
> http://mylocalcomputer/reports$sql2005
> (I have both sql 2000 and sql 2005 on this local box).
> The report path is:
> J4 Report/J4 Detail Report
>
> When I try to run it, I get:
> The attempt to connect to the report server failed. Check your
> connection information and that the report server is a compatible version.
> The request failed with HTTP status 404: Not Found.
>
> When I change the server name to the other one, I get the same message.
>
> However, when I go into SQL Server Reporting services, to this link:
> http://myserver/Reports$SQL2005/Pages/Report.aspx?ItemPath=%2fJ4+reports%2fJ4+Detail+Report
> The report displays fine.
> When I go to my local computer & sql reporting services, to this link:
> http://mylocalcomputer/Reports$SQL2005/Pages/Report.aspx?ItemPath=%2fJ4+Reports%2fJ4+Detail+Report
> I'm not using Localhost either in the VS 2005 app (in the properties for
> the report viewer), but I am calling it (the web app itself where I'm
> trying to call the report viewer from) thru localhost there.
> http://localhost:2228/testjob/default.aspx
> I'm calling other things (not report viewers) on this page that appear
> to work.
> I've seen some notes regarding this error, and that there is a lot of
> registry hacks and config file updates you have to make for it, but not
> sure if that's a true fix for the problem.
> Anyone have any idea why SQL Reporting Services displays it fine, and
> the report viewer - which is supposedly calling the same thing, doesn't?
> BC
>|||Thank you.
This appeared to work, although I had to put in a slash at the end of
the http://mylocalcomputer/ReportServer$sql2005 line.
However, now that I've gotten it to run, I have some unusual behavior -
The "e" on Internet explorer at the top of the tab now flickers, like
the page is reloading. It also runs the CPU up to 100% on the computer
and although I can go from tab to tab in it (I am using AJAX tab panels
in the page), it will take like up to a minute to go to the next tab.
I'm not doing anything really data-intensive on those tabs, and they had
been functioning fine prior to putting in the report viewer (i.e. they
weren't flickering & clocking the CPU).
I eventually have to kill the page to do anything, because it has the
system up to 100%.
Any idea why reportviewer might make this act this way?
Thanks for the help,
BC
David wrote:
> Connect to ReportServer instead of Reports...i.e.
> http://mylocalcomputer/ReportServer$sql2005
> "Blasting Cap" wrote:
>> I'm using VS 2005, SQL 2005 reporting services.
>> SQL reporting services is working, and I have it both on my local
>> computer, as well as on a server.
>> I've created a report in the SQL Business Intelligence development
>> studio that works in that environment.
>> I've uploaded the same report to both the Reporting services on my local
>> computer as well as the server, and can log in to them and run the
>> report there.
>> In VS 2005, in a test application that otherwise functions, I brought in
>> a Reportviewer from the toolbar, and added the report to it.
>> The reportServerUrl is:
>> http://mylocalcomputer/reports$sql2005
>> (I have both sql 2000 and sql 2005 on this local box).
>> The report path is:
>> J4 Report/J4 Detail Report
>>
>> When I try to run it, I get:
>> The attempt to connect to the report server failed. Check your
>> connection information and that the report server is a compatible version.
>> The request failed with HTTP status 404: Not Found.
>>
>> When I change the server name to the other one, I get the same message.
>>
>> However, when I go into SQL Server Reporting services, to this link:
>> http://myserver/Reports$SQL2005/Pages/Report.aspx?ItemPath=%2fJ4+reports%2fJ4+Detail+Report
>> The report displays fine.
>> When I go to my local computer & sql reporting services, to this link:
>> http://mylocalcomputer/Reports$SQL2005/Pages/Report.aspx?ItemPath=%2fJ4+Reports%2fJ4+Detail+Report
>> I'm not using Localhost either in the VS 2005 app (in the properties for
>> the report viewer), but I am calling it (the web app itself where I'm
>> trying to call the report viewer from) thru localhost there.
>> http://localhost:2228/testjob/default.aspx
>> I'm calling other things (not report viewers) on this page that appear
>> to work.
>> I've seen some notes regarding this error, and that there is a lot of
>> registry hacks and config file updates you have to make for it, but not
>> sure if that's a true fix for the problem.
>> Anyone have any idea why SQL Reporting Services displays it fine, and
>> the report viewer - which is supposedly calling the same thing, doesn't?
>> BC
>>