Showing posts with label runtime. Show all posts
Showing posts with label runtime. Show all posts

Friday, March 9, 2012

Error! Must declare the varaible

Hi
Can someone help me with the following problem? I have a report that needs
two parameters at runtime. If I execute this report on the same server as RS
with a data source that is connected to a database on the same server as the
RS server. Then the report execute without any problems.
The setup is as follow:
SQL 2000 running on Windows 2003 Server, with XP Professional
workstations connecting to the RS.There is also three other SQL 2000 servers
running on Windows 2003 Server.
The problem occurs when the Data Source points to a database on a separate
server than the RS server. In this scenario the report executes with an
Error.
An error has occurred during report processing. (rsProcessingAborted) Get
Online Help
Query execution failed for data set 'SRCC'. (rsErrorExecutingCommand) Get
Online Help
Must declare the variable '@.PCode'.
If the report contains no parameters, it executes without any error. Only if
it contains parameters does it execute with an error. If someone can tell me
why this is happening I will really appreciate it.
Thanx
MVAHi,
Have you done anything like this in thr Data tab.
set @.ecode = 1002
select * from employee where empno = @.ecode
Then you will get the error. If you can share the full query with dummy
values that's well and good. If you get "must declare @.pcode" then it must be
something to do with the query and I hope you didnt give anywhere in the
report "@.pcode". In that case you may get this error.
Amarnath.
"MVA" wrote:
> Hi
> Can someone help me with the following problem? I have a report that needs
> two parameters at runtime. If I execute this report on the same server as RS
> with a data source that is connected to a database on the same server as the
> RS server. Then the report execute without any problems.
> The setup is as follow:
> SQL 2000 running on Windows 2003 Server, with XP Professional
> workstations connecting to the RS.There is also three other SQL 2000 servers
> running on Windows 2003 Server.
> The problem occurs when the Data Source points to a database on a separate
> server than the RS server. In this scenario the report executes with an
> Error.
>
> An error has occurred during report processing. (rsProcessingAborted) Get
> Online Help
> Query execution failed for data set 'SRCC'. (rsErrorExecutingCommand) Get
> Online Help
> Must declare the variable '@.PCode'.
>
> If the report contains no parameters, it executes without any error. Only if
> it contains parameters does it execute with an error. If someone can tell me
> why this is happening I will really appreciate it.
>
> Thanx
> MVA
>
>

Friday, February 17, 2012

Error while inserting data in DataBase ?

my requirment is insert TableName and JourneyDate and FlightNumber alongwith otherdata at RunTime but i get error, I tried it several times.

Table Structure is:

Create Table HA142(JourneyDateDateTime primary key,FlightNochar(5)not nullFOREIGN kEY REFERENCES FLIGHTS(FlightNo),FirstClassSeatAvalableint,BusinessClassSeatAvalableint,EconomyClassSeatAvalableint,FsWaitingAvalableint,BsWaitingAvalableint,EcWaitingAvalableint)
string flightno = drpFlightNo.SelectedItem.Text;string JourneyDate = Session["JourneyDate"].ToString();string newStrign =",18,42,280,3,7,35)";SqlConnection myConn =new SqlConnection("workstation id=JASIM;packet size=4096;user id=ASPNET;data source=JASIM;persist security info=False;initial catalog=Test");SqlCommand populateFlightTable =new SqlCommand("INSERT INTO "+flightno+" VALUES("+JourneyDate+","+flightno+newStrign,myConn);myConn.Open();populateFlightTable.ExecuteNonQuery();myConn.Close();

whenever compiler reached topopulateFlightTable.ExecuteNonQuery();I received error. i tried it to rectify several times but no result.

plz hemp me...

Your insert statement is incorrect.

Read this article to know how that works

http://www.w3schools.com/sql/sql_insert.asp

HTH
Regards

|||

I am passing Table name at runtime becouse user does't not know in which table he is inserting date, it is based on his input record. that's why i am trying to accept table name and first two field of that table from user at run time.

So if I made any mistake in my code, plz tell me what is wrong and how to solve it. By using stored prosedure it is not possible to accept table along name with their Fields at runtime.

|||Thank you it was Syntax Error.