Showing posts with label create. Show all posts
Showing posts with label create. Show all posts

Thursday, March 22, 2012

Error in the Stored Procedure

I am trying to swap two rows in a table .. I am stuck with this error since a long time.. can anyone guess where the problem is ? create procedure was working fine in query analyzer but when used it in the stored procedure. I am getting these .. can anyone help me out please ... Your help will be greatly appreciated.. UpdateRowsReorderUp is my storedprocedure ... and i am using MS Sql 2000 .. am I doing something really wrong which i'm not supposed to ???

Thanks friends..

Procedure 'UpdateRowsReorderUp' expects parameter '@.nextlowestsortID', which was not supplied.

CREATE PROCEDURE [dbo].[UpdateRowsReorderUp]

(

@.intsortID int,

@.nextlowestsortID int,

@.MemberID int

)

AS

Select @.nextlowestsortID=(Select Top 1 SortID from SelectedCredits where SortID<@.intsortID order by SortID DESC)

UPDATE SelectedCredits SET SortID= CASE

WHEN SortID = @.nextlowestsortID then @.intsortID

WHEN SortID = @.intsortID then @.nextlowestsortID ELSE SortID End

WHERE MemberID = @.MemberID

SELECT * FROM SelectedCredits WHERE MemberID= @.MemberID ORDER BY SortID

GO

**************

// this is my script on the page

void moveup(Object s, DataListCommandEventArgs e) {

objcmd= new SqlCommand("UpdateRowsReorderUp",objConn);

objcmd.CommandType = CommandType.StoredProcedure;

objcmd.Parameters.Add("@.intsortID",intsortID);

objcmd.Parameters.Add("@.MemberID",Session["MemberID"]);

objRdr= objcmd.ExecuteReader();

dlSelCredits.DataSource = objRdr;

dlSelCredits.DataBind();

objRdr.Close();

objConn.Close();

BindData();

}

You are missing the @.nextlowestsortid parameter in your code. Add it between the other two.
|||

Thanks for your reply . I'm storing a value in the @.nextlowestsortid using a SELECT statement.I am not assigning any value outside so that i can pass it into the parameter. for example @.intsortid i'm assiging intsortid through the code but what can i assign to this? Sorry to ask like this i am a newbie in this field..

Can i write the SELECT statement in different way so that there is no need add any parameter through the code ??

|||If the @.nextlowestsortid parameter is an internal parameter, remove itfrom the parameter list and declare it after the AS, like this:
DECLARE @.nextlowestsortid int
Then you stored procedure will only have two parameters that you supply, and the error will go away.
Sam
|||

Thank you very much Sam .. I am really grateful to you ..

You solved my problem .. that was the perfect solution ..

cheers mate

Monday, March 19, 2012

error in sp when using order by

CREATE PROCEDURE getC

AS
(
SELECT top 3 c FROM table1
order by c Desc

)
GO


and it gives me error "Incorrect syntax near keyword order", and secondly how will i get the result in a var like...

CREATE PROCEDURE getC

@.d char(6)
AS
(
SELECT @.d=top 1 c FROM table1
order by c Desc

)
GOYou can't use order by clause on an SP.

Paulo|||-- SQL Code Begins Here
-- exec test23
create proc test23
as

declare @.top as varchar(50)
declare @.top1 as varchar(50)
declare @.top2 as varchar(50)
declare @.top3 as varchar(50)
declare @.row_count as int

set @.row_count = 1

DECLARE top3_cursor CURSOR FOR

select top 3 author_code from lauthors
order by author_code desc

OPEN top3_cursor
FETCH NEXT FROM top3_cursor into @.top
-- Check @.@.FETCH_STATUS to see if there are any more rows to fetch.
WHILE @.@.FETCH_STATUS = 0
BEGIN
-- This is executed as long as the previous fetch succeeds.
if @.row_count = 1
begin
set @.top1 = @.top
set @.top = ''
end

if @.row_count = 2
begin
set @.top2 = @.top

set @.top = ''
end

if @.row_count = 3
begin
set @.top3 = @.top

set @.top = ''
end

set @.row_count = @.row_count + 1

FETCH NEXT FROM top3_cursor into @.top
END
CLOSE top3_cursor
DEALLOCATE top3_cursor

select @.top1 as top1, @.top2 as top2, @.top3 as top3

go

-- SQL Code Ends Here

Hope this is what you are looking for

Roshmi Choudhury|||I'd just use something like:CREATE PROCEDURE getC
@.d CHAR(6) OUTPUT
AS

SELECT @.d = Max(c)
FROM table1

RETURN
GO-PatP|||the problem is DESC field..
you can't use this word.. because is a reserved word!!!
rename field or use order by [DESC]

DESC is a reserved word for DESCENDING in order by clause..
ex. select * fro mauthors order by aut_id desc
orders in descending mode..

it's ok??|||this message it was not for this thread..
sorry =)))

error in restore script

I have attempted to create a script to do a backup and restore that would be useable for several different database servers. The script works fine on SQL 2000 but on SQL 7 I get the following error.

Server: Msg 3156, Level 16, State 2, Line 1
[Microsoft][ODBC SQL Server Driver][SQL Server]The file 'C:\temp\test_log.ldf ' cannot be used by RESTORE. Consider using the WITH MOVE option to identify a valid location for the file.
Server: Msg 3013, Level 16, State 1, Line 1
[Microsoft][ODBC SQL Server Driver][SQL Server]Backup or restore operation terminating abnormally.

The piece of code in question is:

EXEC('RESTORE DATABASE '+@.targetdb+'
FROM DISK = '''+@.sourcedb_backupdir+'''
WITH REPLACE, RECOVERY,
MOVE '''+@.source_restore_mdf_name+''' TO '''+@.target_restore_mdf_dir+''',
MOVE '''+@.source_restore_ldf_name+''' TO '''+@.target_restore_ldf_dir+'''')

Any help would be appreciated

The whole script (version SQL 7) is attached if that would help as well.I have gotten this message when I was restoring a dump that was from a different database. I see that you do use the MOVE, have you verified the physical and logical names? Instead of doing the EXEC, how about doing a PRINT, for debugging and see what the command is.|||This is what I get when I use the print statement:


RESTORE DATABASE test
FROM DISK = 'C:\temp\Northwind.bak'
WITH REPLACE, RECOVERY,
MOVE 'Northwind' TO 'c:\temp\test.mdf',
MOVE 'Northwind_log' TO 'C:\temp\test_log.ldf'

I get the following error in Query Analyzer:

Server: Msg 3156, Level 16, State 2, Line 1
[Microsoft][ODBC SQL Server Driver][SQL Server]The file 'c:\temp\test.mdf' cannot be used by RESTORE. Consider using the WITH MOVE option to identify a valid location for the file.
Server: Msg 3013, Level 16, State 1, Line 1
[Microsoft][ODBC SQL Server Driver][SQL Server]Backup or restore operation terminating abnormally.

When I look in the error log I get this error message:

2002-04-04 11:57:16.41 kernel BackupFileDesc::VerifyCreatability: Operating system error 32(The process cannot access the file because it is being used by another process.) during the creation/opening of physical device C:\temp\test_log.ldf

2002-04-04 13:28:15.00 kernel BackupFileDesc::VerifyCreatability: Operating system error 32(The process cannot access the file because it is being used by another process.) during the creation/opening of physical device c:\temp\test.mdf. 0

This error is confusing because before I start the restore I kill all users and put the db in single user mode.|||When you run the RESTORE command are you excuting it from MASTER? Is the logical names for database Northwind correct 'Northwind' for database file and 'Northwind_log' for transaction log? Also are the physical files for Test 'c:\temp\test.mdf' for data and 'C:\temp\test_log.ldf' for transaction log.
Just looking at the physical names they look like they would be the default names SQL Server generates <database name>_log.ldf and <database name>_data.mdf . The only thing is that if this is true then your physical name should be 'c:\temp\test_data.mdf'|||I am useing the master db.

If I run sp_helpdb for Northwind I get the following:

Northwind, 1, C:\MSSQL\DATA\northwnd.mdf, PRIMARY, 4864 KB, Unlimited, 10%, data only

Northwind_log, 2, C:\MSSQL7\DATA\northwnd.ldf, NULL, 1024 KB, Unlimited, 10%, log only

If I run sp_helpdb for test I get the following:

Northwind, 1, c:\temp\test.mdf, PRIMARY, 4864 KB, Unlimited, 10%, data only

Northwind_log, 2, C:\temp\test_log.ldf, NULL, 1024 KB, Unlimited, 10%, log only

When I set my variables I use the following:

CREATE TABLE #db_sysfiles
(
name VARCHAR(50),
filename VARCHAR(255),
dbname VARCHAR(50)
)

INSERT INTO #db_sysfiles EXEC ('SELECT a.name, a.filename, b.name FROM '+@.sourcedb+'..sysfiles a, master..sysdatabases b WHERE b.name = '''+@.sourcedb+'''')

INSERT INTO #db_sysfiles EXEC ('SELECT a.name, a.filename, b.name FROM '+@.targetdb+'..sysfiles a, master..sysdatabases b WHERE b.name = '''+@.targetdb+'''')

SELECT @.source_restore_mdf_name = RTRIM(name)
FROM #db_sysfiles
WHERE filename
LIKE '%.mdf%'
AND dbname = @.sourcedb

SELECT @.source_restore_ldf_name = RTRIM(name)
FROM #db_sysfiles
WHERE filename LIKE '%.ldf%'
AND dbname = @.sourcedb

SELECT @.target_restore_mdf_name = RTRIM(name)
FROM #db_sysfiles
WHERE filename
LIKE '%.mdf%'
AND dbname = @.targetdb

SELECT @.target_restore_ldf_name = RTRIM(name)
FROM #db_sysfiles
WHERE filename
LIKE '%.ldf%'
AND dbname = @.targetdb

SELECT @.target_restore_mdf_dir = RTRIM(filename)
FROM #db_sysfiles
WHERE filename
LIKE '%.mdf%'
AND dbname = @.targetdb

SELECT @.target_restore_ldf_dir = RTRIM(filename)
FROM #db_sysfiles
WHERE filename
LIKE '%.ldf%'
AND dbname = @.targetdb

SELECT @.source_restore_mdf_dir = RTRIM(filename)
FROM #db_sysfiles
WHERE filename
LIKE '%.mdf%'
AND dbname = @.sourcedb

SELECT @.source_restore_ldf_dir = RTRIM(filename)
FROM #db_sysfiles
WHERE filename
LIKE '%.ldf%'
AND dbname = @.sourcedb

error in report builder

I am trying to create a filter in the report builder on reporting services. When I try to filter I get a yellow triangle with an exclamation point and cannot get a list. When i put my cursor over the yellow triangle, I get the error "the requested list could not be retrived because the query is not valid or a connection could not be made to the data source. Any idea how this can be fixed so I can get a list of values?

This usually means you have something wrong with the data source connection behind the report model. Check that your model has a data source specified, and that the data source has a valid connection string and appropriate credentials.

Hope that helps!

|||I am not sure if you found a solution to this problem, but I also ran into the same problem recently.

Currently, I am using a folder structure like:
Home>Dept>App>(Model, Datasource, Reports)

I found that by granting "View folders" at the home level to the group/user resolved the issue. I created a custom Item-Level role with just this task to restrict access, but either the Browser or Report Builder roles would work as well as they have the "View folders" task associted with them.

However, if at all possible I would like to avoid giving users access to the Home folder so if someone could explain where and why this dependency exists it would be much appericated.

error in report builder

I am trying to create a filter in the report builder on reporting services. When I try to filter I get a yellow triangle with an exclamation point and cannot get a list. When i put my cursor over the yellow triangle, I get the error "the requested list could not be retrived because the query is not valid or a connection could not be made to the data source. Any idea how this can be fixed so I can get a list of values?

This usually means you have something wrong with the data source connection behind the report model. Check that your model has a data source specified, and that the data source has a valid connection string and appropriate credentials.

Hope that helps!

|||I am not sure if you found a solution to this problem, but I also ran into the same problem recently.

Currently, I am using a folder structure like:
Home>Dept>App>(Model, Datasource, Reports)

I found that by granting "View folders" at the home level to the group/user resolved the issue. I created a custom Item-Level role with just this task to restrict access, but either the Browser or Report Builder roles would work as well as they have the "View folders" task associted with them.

However, if at all possible I would like to avoid giving users access to the Home folder so if someone could explain where and why this dependency exists it would be much appericated.

Sunday, March 11, 2012

error in report builder

I am trying to create a filter in the report builder on reporting services. When I try to filter I get a yellow triangle with an exclamation point and cannot get a list. When i put my cursor over the yellow triangle, I get the error "the requested list could not be retrived because the query is not valid or a connection could not be made to the data source. Any idea how this can be fixed so I can get a list of values?

This usually means you have something wrong with the data source connection behind the report model. Check that your model has a data source specified, and that the data source has a valid connection string and appropriate credentials.

Hope that helps!

|||I am not sure if you found a solution to this problem, but I also ran into the same problem recently.

Currently, I am using a folder structure like:
Home>Dept>App>(Model, Datasource, Reports)

I found that by granting "View folders" at the home level to the group/user resolved the issue. I created a custom Item-Level role with just this task to restrict access, but either the Browser or Report Builder roles would work as well as they have the "View folders" task associted with them.

However, if at all possible I would like to avoid giving users access to the Home folder so if someone could explain where and why this dependency exists it would be much appericated.

Error in my 8 table SQL Script

/*Script Start*/

create database HorizonAirways

create table Sector
(
SectorID Char(5) constraint SectorID primary key clustered not null,
Description VarChar(50) not null,
WeekDay1 char(3) not null,
WeekDay2 char(3) not null,
FirstClassFare Money not null,
BusinessClassFare Money not null,
EconomyClassFare Money not null
)

select * from Sector

create table Aircraft
(
AircraftTypeID char(4) constraint AircraftTypeID primary key clustered not null,
Description char(30) not null,
FirstClassSeats int not null,
BusinessClassSeats int not null,
EconomyClassSeats int not null
)
select * from Aircraft

create table flights
(
FlightNo char(5) constraint FlightNo primary key clustered not null,
DepTime char(5) not null,
ArrTime char(5) not null,
AircraftTypeID char(4) references Aircraft(AircraftTypeID) not null,
SectorID Char(5) references Sector(SectorID) not null
)

select * from Flights

create table ScheduledFlights
(
FlightNo char(5) references flights(FlightNo) not null,
FlightDate datetime not null,
FirstClassSeatsAvailable int not null,
BusinessClassSeatsAvailable int not null,
EconomyClassSeatsAvailable int not null
)

select * from ScheduledFlights

create table passenger
(
PnrNo char(8) constraint PNR primary key clustered not null,
FlightNo char(5) references flights(FlightNo) not null,

TravelDate datetime constraint PassengerFlights Foreign key (FlightNo, DeptTime) references flights (FlightNo,DepTime) not null,

FName char(20) not null,
LName char(20) not null,
Age int not null,
Gender char(1) not null,
Class char(15) not null,
SeatPref char(6) not null,
MealPref char(15) not null,
SSR varchar(100) not null,
Status char(15)
)

create table DailyCollection
(
PnrNo char(8) references Passenger(PnrNo) not null,
TransDate Datetime not null,
TranType Char(1) not null,
Amount Float not null
)

create table users
(
UserName char(15) constraint Username primary key clustered not null,
Password char(15) not null,
UserRole Char(15) not null
)

!!OUTPUT!!

--
Msg 8140, Level 16, State 0, Line 48
More than one key specified in column level FOREIGN KEY constraint, table 'passenger'.
Msg 1769, Level 16, State 1, Line 48
Foreign key 'PassengerFlights' references invalid column 'DeptTime' in referencing table 'passenger'.
Msg 1750, Level 16, State 0, Line 48
Could not create constraint. See previous errors.
--

--
In the project given by our teacher it says about Passenger Table
Pnr(PK)- Char (8) no null values

FlightNo- Char(5) no null values

TravelDate- DateTime no null values
info-Date of travel. The flight number and the date of travel together gorm a foreign key that references the flight number and the flight date in theFlight Table.
--
rest is fine.....

CAN ANYONE PLEASE RECTIFY THESE ERRORS ?
There are some typos in your script as well as problem with contraints. My preferable way to define constraints is to use separate statements instead of inline within the table creation script. I addition you can only reference primary keys (one or more column as a combound key) with a foreign key constraint. So you will either have to extend the primary key in the flights table to the DeptTime ot narrow the foreign key on the passenger table to flightNo only. As of my knowledge about flight it has to be the first solution, right ? :-)

create table passenger

(

PnrNo char(8) constraint PNR primary key clustered not null,

FlightNo char(5) not null,

FName char(20) not null,

LName char(20) not null,

Age int not null,

Gender char(1) not null,

Class char(15) not null,

SeatPref char(6) not null,

MealPref char(15) not null,

SSR varchar(100) not null,

Status char(15),

TravelDate datetime

)

ALTER TABLE Passenger

ADD CONSTRAINT FK_Passenger_Flights FOREIGN KEY (FlightNo, TravelDate)

references flights(FlightNo, DepTime)

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||Thank you very much.

In future i will use your way. I will define constraints separately. Cheers !!
|||Great reply and its works..

Error in my 8 table SQL Script

/*Script Start*/

create database HorizonAirways

create table Sector
(
SectorID Char(5) constraint SectorID primary key clustered not null,
Description VarChar(50) not null,
WeekDay1 char(3) not null,
WeekDay2 char(3) not null,
FirstClassFare Money not null,
BusinessClassFare Money not null,
EconomyClassFare Money not null
)

select * from Sector

create table Aircraft
(
AircraftTypeID char(4) constraint AircraftTypeID primary key clustered not null,
Description char(30) not null,
FirstClassSeats int not null,
BusinessClassSeats int not null,
EconomyClassSeats int not null
)
select * from Aircraft

create table flights
(
FlightNo char(5) constraint FlightNo primary key clustered not null,
DepTime char(5) not null,
ArrTime char(5) not null,
AircraftTypeID char(4) references Aircraft(AircraftTypeID) not null,
SectorID Char(5) references Sector(SectorID) not null
)

select * from Flights

create table ScheduledFlights
(
FlightNo char(5) references flights(FlightNo) not null,
FlightDate datetime not null,
FirstClassSeatsAvailable int not null,
BusinessClassSeatsAvailable int not null,
EconomyClassSeatsAvailable int not null
)

select * from ScheduledFlights

create table passenger
(
PnrNo char(8) constraint PNR primary key clustered not null,
FlightNo char(5) references flights(FlightNo) not null,

TravelDate datetime constraint PassengerFlights Foreign key (FlightNo, DeptTime) references flights (FlightNo,DepTime) not null,

FName char(20) not null,
LName char(20) not null,
Age int not null,
Gender char(1) not null,
Class char(15) not null,
SeatPref char(6) not null,
MealPref char(15) not null,
SSR varchar(100) not null,
Status char(15)
)

create table DailyCollection
(
PnrNo char(8) references Passenger(PnrNo) not null,
TransDate Datetime not null,
TranType Char(1) not null,
Amount Float not null
)

create table users
(
UserName char(15) constraint Username primary key clustered not null,
Password char(15) not null,
UserRole Char(15) not null
)

!!OUTPUT!!

--
Msg 8140, Level 16, State 0, Line 48
More than one key specified in column level FOREIGN KEY constraint, table 'passenger'.
Msg 1769, Level 16, State 1, Line 48
Foreign key 'PassengerFlights' references invalid column 'DeptTime' in referencing table 'passenger'.
Msg 1750, Level 16, State 0, Line 48
Could not create constraint. See previous errors.
--

--
In the project given by our teacher it says about Passenger Table
Pnr(PK)- Char (8) no null values

FlightNo- Char(5) no null values

TravelDate- DateTime no null values
info-Date of travel. The flight number and the date of travel together gorm a foreign key that references the flight number and the flight date in the Flight Table.
--
rest is fine.....

CAN ANYONE PLEASE RECTIFY THESE ERRORS ?There are some typos in your script as well as problem with contraints. My preferable way to define constraints is to use separate statements instead of inline within the table creation script. I addition you can only reference primary keys (one or more column as a combound key) with a foreign key constraint. So you will either have to extend the primary key in the flights table to the DeptTime ot narrow the foreign key on the passenger table to flightNo only. As of my knowledge about flight it has to be the first solution, right ? :-)

create table passenger

(

PnrNo char(8) constraint PNR primary key clustered not null,

FlightNo char(5) not null,

FName char(20) not null,

LName char(20) not null,

Age int not null,

Gender char(1) not null,

Class char(15) not null,

SeatPref char(6) not null,

MealPref char(15) not null,

SSR varchar(100) not null,

Status char(15),

TravelDate datetime

)

ALTER TABLE Passenger

ADD CONSTRAINT FK_Passenger_Flights FOREIGN KEY (FlightNo, TravelDate)

references flights(FlightNo, DepTime)

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||Thank you very much.

In future i will use your way. I will define constraints separately. Cheers !!|||Great reply and its works..

Friday, March 9, 2012

Error in Merge replication "The schema script..."

I'm trying to set up a merge replication. Publication is created successfully and snapshot also, but when I create pull subscription on subscriber server and merge agent starts, after some time I get an error message of this type:

The schema script '\\ANIL\REPLDATA\unc\ANIL_BEJK_BEJK\20070625142735\dl_HF_vMSCene_3836.sch' could not be propagated to the subscriber.

It seams there is a problem with certain Views and SPs, because tables are successfully created, and some Views and SPs also.

I tried to exclude problematic articles, but every time another one pops up. Up until now, I excluded 7 articles from publication (1 Stored Procedure and 6 Views) but I still get errors.

I gave up because I can't exclude half of the Views and SPs just to make it work.

Is there something that can be done to solve this problem?

Thanks!
Does your SQL Server agent account have rights to read the share \\anil\repldata? Ensure that this account also has rights to list files and folders on the physical drive underlying \\anil\repldata.

If you are using a push subscription it should be the SQL Server agent account on the publisher. If you are using a pull subscription is should be the SQL Server agent account on the subscriber.|||

Hi Hilary

Sharing permisions were set to Read/Write to "Everyone", and security permisions also Read/Write to "Everyone", but it didn't work until I added an account on subscriber computer (which is not in domain) with same username and password as one that exists on publisher (which is in domain). I set SQL Server Agent to use that account and everything started to work fine.

I'm connecting to publisher using the VPN, and despite the fact that those two accounts are not from the same domain, everything is working fine. This is a little bit confusing. It looks like domain name doesn't play any role when logging in to shared folder.

Thanks for the help.

Anil

Error in Merge replication "The schema script..."

I'm trying to set up a merge replication. Publication is created successfully and snapshot also, but when I create pull subscription on subscriber server and merge agent starts, after some time I get an error message of this type:

The schema script '\\ANIL\REPLDATA\unc\ANIL_BEJK_BEJK\20070625142735\dl_HF_vMSCene_3836.sch' could not be propagated to the subscriber.

It seams there is a problem with certain Views and SPs, because tables are successfully created, and some Views and SPs also.

I tried to exclude problematic articles, but every time another one pops up. Up until now, I excluded 7 articles from publication (1 Stored Procedure and 6 Views) but I still get errors.

I gave up because I can't exclude half of the Views and SPs just to make it work.

Is there something that can be done to solve this problem?

Thanks!
Does your SQL Server agent account have rights to read the share \\anil\repldata? Ensure that this account also has rights to list files and folders on the physical drive underlying \\anil\repldata.

If you are using a push subscription it should be the SQL Server agent account on the publisher. If you are using a pull subscription is should be the SQL Server agent account on the subscriber.|||

Hi Hilary

Sharing permisions were set to Read/Write to "Everyone", and security permisions also Read/Write to "Everyone", but it didn't work until I added an account on subscriber computer (which is not in domain) with same username and password as one that exists on publisher (which is in domain). I set SQL Server Agent to use that account and everything started to work fine.

I'm connecting to publisher using the VPN, and despite the fact that those two accounts are not from the same domain, everything is working fine. This is a little bit confusing. It looks like domain name doesn't play any role when logging in to shared folder.

Thanks for the help.

Anil

Error in loading RPT files

I need your help

Having these errors when my application is trying to load rpt files. On my workstation it works perfectly but after I create a setup and install it on another machine i get these errors.

VB6 + CR 9.2 + Visual studio Package and Deployment.

The instruction at "0x7c93426d" referenced memory at "0x00000000". The memory could not be "read".

The instruction at "0x3b48b401" referenced memory at "0x03d4b000". The memory could not be "written".

Dim Crapp As New CRAXDDRT.Application
Dim oReport As New CRAXDDRT.Report

Set Crapp = New CRAXDDRT.Application
Set oReport = New CRAXDDRT.Report

PFld = Trim(Text1.Text)

oReport.DiscardSavedData
oReport.EnableParameterPrompting = False

'Set oReport = crApp.OpenReport(App.Path & "\" & RptPath)
oReport.ParameterFields(1).AddCurrentValue PFld

oReport.ReadRecords

Me.MousePointer = vbHourglass
With Form2.CRViewer91

.ReportSource = oReport
.ViewReport
.Refresh
End With

set crapp = nothing
set oreport = nothing

Me.MousePointer = vbArrow
Unload Me
Form2.ShowAnyone Please I need your help.

Please.

Sunday, February 26, 2012

Error in Dynamic SQL.....help!!

Can someone please help me in troubleshooting the code below. I have a table called credit_app_table_status which is based on the following create statement:

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[credit_app_table_status]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[credit_app_table_status]
GO

CREATE TABLE [dbo].[credit_app_table_status] (
[table_name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[bill_period_start] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[bill_period_end] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO

When I run the code below, it gives me the following error message. I have tried to change the data types of bill_period_start and bill_period_end apart from changing the code, but it doesn't work. Instead of @.bill_period_start and @.bill_period_end, if I have actual dates, it works. Can someone pleaseeeee help.

/* Error Message
Server: Msg 170, Level 15, State 1, Line 12
Line 12: Incorrect syntax near '1'.
Server: Msg 156, Level 15, State 1, Line 27
Incorrect syntax near the keyword 'and'.
*/

--Code

Declare
@.SQL VarChar(2000),
@.tablename varchar (20),
@.bill_period_start varchar (20),
@.bill_period_end varchar (20)

SELECT @.tablename = table_name from credit_app_table_status
SELECT @.bill_period_start = bill_period_start from credit_app_table_status
SELECT @.bill_period_end = bill_period_end from credit_app_table_status

SELECT @.SQL = 'insert into ' + @.TableName + ' (
bill_period_begin,
bill_period_end,
org_id,
bill_type_cn,
qty,
rate,
total_amt,
add_user_id,
add_date
)
select '
+ @.bill_period_start +
','
+ @.bill_period_end +
',
a.org_id,
14,
sum(a.orders)as qty,
-.75 as rate,
sum(a.orders) * -.75,
1493,
getdate()
from cph..tblPkgFlatDaily a
where a.priority_cn = 0
and a.org_id in
(select org_id
from csorg_ins_group where
group_type_cn not in (7,8,9,10)
)
and a.ship_date between '
+ @.bill_period_start +
' and '
+ @.bill_period_end +
'group by a.org_id order by a.org_id'

Exec ( @.SQL)

GO+ @.bill_period_end +
'group by a.org_id order by a.org_id'


Exec ( @.SQL)

GO
It looks like your group by does not have a space preceeding it.

In your testing, why don't you select @.sql and view it first, and then when it looks good try the execution?|||It looks like your group by does not have a space preceeding it.

In your testing, why don't you select @.sql and view it first, and then when it looks good try the execution?
Thanks for the information Tomh3. The problem that I saw was that
@.bill_period_start and @.bill_period_end didn't have the single quotes such as in:
'Sep 1 2004 12:00AM'. Can you please let me know how I can get single quotes in @.bill_period_start and @.bill_period_end.

Thank you so much!!

Below is the code I received using select @.sql:

insert into csorg_billing_flash
(bill_period_begin,
bill_period_end,
org_id,
bill_type_cn,
qty,
rate,
total_amt,
add_user_id,
add_date)
select
Sep 1 2004 12:00AM,
Oct 31 2004 12:00AM ,
a.org_id,
14,
sum(a.orders)as qty,
-.75 as rate,
sum(a.orders) * -.75,
1493,
getdate()
from cph..tblPkgFlatDaily a
where a.priority_cn = 0
and a.org_id in
(select org_id
from csorg_ins_group
where group_type_cn not in (7,8,9,10)
)
and a.ship_date between
Sep 1 2004 12:00AM and Oct 31 2004 12:00AM
group by a.org_id
order by a.org_id|||DECLARE @.bill_period_start datetime
SELECT @.bill_period_start = 'Sep 1 2004 12:00AM'
SELECT ''''+CONVERT(varchar(25),@.bill_period_start)+''''|||Thanks for the reply, Brett.

I think I am very close to getting query in shape. However, when I use
SELECT @.bill_period_start = ''''+CONVERT(varchar(25),@.bill_period_start)+''''

I receive the following error:
Server: Msg 241, Level 16, State 1, Line 24
Syntax error converting datetime from character string.

I will really appreciate if you could please help in troubleshooting this piece of code:

Declare
@.SQL VarChar(2000),
@.tablename varchar (20),
@.bill_period_start datetime,
@.bill_period_end datetime

SELECT @.tablename = table_name from credit_app_table_status
SELECT @.bill_period_start = ''''+CONVERT(varchar(25),@.bill_period_start)+'''' from credit_app_table_status
SELECT @.bill_period_end = ''''+CONVERT(varchar(25),@.bill_period_end)+'''' from credit_app_table_status

SELECT @.SQL = 'insert into ' + @.TableName + ' (
bill_period_begin,
bill_period_end,
org_id,
bill_type_cn,
qty,
rate,
total_amt,
add_user_id,
add_date
)
select '
+ @.bill_period_start +
', '
+ @.bill_period_end +
',
a.org_id,
14,
sum(a.orders)as qty,
-.75 as rate,
sum(a.orders) * -.75,
1493,
getdate()
from cph..tblPkgFlatDaily a
where a.priority_cn = 0
and a.org_id in
(select org_id
from csorg_ins_group where
group_type_cn not in (7,8,9,10)
)
and a.ship_date between '
+ @.bill_period_start +
'and '
+ @.bill_period_end +
'group by a.org_id order by a.org_id'

SELECT (@.SQL)

GO|||Thanks for the reply, Brett.

I think I am very close to getting query in shape. However, when I use
SELECT @.bill_period_start = ''''+CONVERT(varchar(25),@.bill_period_start)+''''

I receive the following error:
Server: Msg 241, Level 16, State 1, Line 24
Syntax error converting datetime from character string.

I will really appreciate if you could please help in troubleshooting this piece of code:

SELECT @.tablename = table_name from credit_app_table_status
SELECT @.bill_period_start = ''''+CONVERT(varchar(25),@.bill_period_start)+'''' from credit_app_table_status
SELECT @.bill_period_end = ''''+CONVERT(varchar(25),@.bill_period_end)+'''' from credit_app_table_status


Oh so close. Try this

SELECT @.bill_period_start = ''''+CONVERT(varchar(25),@.bill_period_start,120)+' ''' from credit_app_table_status
SELECT @.bill_period_end = ''''+CONVERT(varchar(25),@.bill_period_end,120)+''' ' from credit_app_table_status

That will force the string into yyyy-mm-dd format instead of the default presentation format you showed us in the previous output.

And don't forget to keep Brett's additional apostrophes.

FYI, when I do something like this I create a variable named @.apos and populate it with a single apostrophe. So my string concatenation would read like ... + @.apos + @.string_variable + @.apos + ... it makes it easier for me to separate double apostrophe ('') from quote(").|||Oh so close. Try this

SELECT @.bill_period_start = ''''+CONVERT(varchar(25),@.bill_period_start,120)+' ''' from credit_app_table_status
SELECT @.bill_period_end = ''''+CONVERT(varchar(25),@.bill_period_end,120)+''' ' from credit_app_table_status

That will force the string into yyyy-mm-dd format instead of the default presentation format you showed us in the previous output.

And don't forget to keep Brett's additional apostrophes.

FYI, when I do something like this I create a variable named @.apos and populate it with a single apostrophe. So my string concatenation would read like ... + @.apos + @.string_variable + @.apos + ... it makes it easier for me to separate double apostrophe ('') from quote(").
Sorry, but I am still getting the same error message. Also I tried to run it having an apostrophe around @.bill_period_start and @.bill_period_end and still it doesn't work.
For example:

+ ' @.bill_period_start ' +
'and '
+ ' @.bill_period_end ' +|||SELECT @.bill_period_start = ''''+CONVERT(varchar(25),@.bill_period_start)+''''

I receive the following error:
Server: Msg 241, Level 16, State 1, Line 24
Syntax error converting datetime from character string.

That doesn't make sense...

Can you post the DDL of the Table...

And do this as well...

SELECT * FROM cph..tblPkgFlatDaily
WHERE ISNULL(ship_date)=0

If you get anything back from that, you have data problems...|||--Here is the DDL for credit_app_table_status

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[credit_app_table_status]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[credit_app_table_status]
GO

CREATE TABLE [dbo].[credit_app_table_status] (
[table_name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[bill_period_start] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[bill_period_end] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO

--Here is the DDL for tblPkgFlatDaily

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblPkgFlatDaily]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tblPkgFlatDaily]
GO

CREATE TABLE [dbo].[tblPkgFlatDaily] (
[org_id] [int] NULL ,
[Orders] [int] NULL ,
[priority_cn] [int] NOT NULL ,
[ship_date] [datetime] NULL
) ON [PRIMARY]
GO|||SELECT @.bill_period_start = ''''+CONVERT(varchar(25),@.bill_period_start)+''''

I receive the following error:
Server: Msg 241, Level 16, State 1, Line 24
Syntax error converting datetime from character string.

That doesn't make sense...

Can you post the DDL of the Table...

And do this as well...

SELECT * FROM cph..tblPkgFlatDaily
WHERE ISNULL(ship_date)=0

If you get anything back from that, you have data problems...
--Here is the DDL for credit_app_table_status

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[credit_app_table_status]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[credit_app_table_status]
GO

CREATE TABLE [dbo].[credit_app_table_status] (
[table_name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[bill_period_start] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[bill_period_end] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO

--Here is the DDL for tblPkgFlatDaily

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblPkgFlatDaily]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tblPkgFlatDaily]
GO

CREATE TABLE [dbo].[tblPkgFlatDaily] (
[org_id] [int] NULL ,
[Orders] [int] NULL ,
[priority_cn] [int] NOT NULL ,
[ship_date] [datetime] NULL
) ON [PRIMARY]
GO

Error in Data-Driven Subscription

Hi, I'm trying to finish the Report Service 2005 Tutorial but I can't. When I create a Data-Driven Subscription, it is trigered and the job is finished succesfully, but in status of my subscription show me "Done: 3 processed of 3 total; 3 errors" and don't send any e-mail.

How can I see this errors?

Thanks.

You need to look in the ReportServerService_<timestamp>.log file. The error is in there.

Friday, February 24, 2012

Error in Creating Stored Procedure from VS 2005

When I create a stored procedure in VS 2005 using C# and deploy it to the server I can't execute it there and here is the error message:

Msg 6522, Level 16, State 1, Procedure GetAll, Line 0

A .NET Framework error occurred during execution of user defined routine or aggregate 'GetAll':

System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

System.Security.SecurityException:

at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)

at System.Security.PermissionSet.Demand()

at System.Data.Common.DbConnectionOptions.DemandPermission()

at System.Data.SqlClient.SqlConnection.PermissionDemand()

at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)

at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)

at System.Data.SqlClient.SqlConnection.Open()

at StoredProcedures.GetAll()

and the code for creating the stored procedure is:

SqlConnection connDB = new SqlConnection(@."Initial Catalog=MDB;Data Source=Server1;");

SqlCommand cmd = new SqlCommand();

cmd.Connection = connDB;

cmd.CommandText = "SELECT * FROM Modifier";

connDB.Open();

SqlDataReader rdr = cmd.ExecuteReader();

SqlContext.Pipe.Send(rdr);

rdr.Close();

connDB.Close();

your help is appreciated...

What is the permission_set that you assigned for the assembly? This is the one in the CREATE ASSEMBLY. You need to set it to EXTERNAL_ACCESS due to use of SqlConnection that is accessing remote resource. Additionally, you will have to enable TRUST_WORTHY bit (use with care) or do the recommended key based login creation & assign external access assembly permission to it and use that user as owner of the assembly. If you download the new version of SQL Server 2005 Books Online it should contain updated topics that show how to do this. If you need some examples, please post back and I will try to locate a sample for you.|||

I am getting the same error when trying to debug my stored procedure. How do I get around int?

Here's my code:

Try

Dim conn As SqlConnection = New SqlConnection

conn.ConnectionString = "Data Source=XXX-XXXX\SQLSERVER2005;Initial Catalog=MotorFleetConversion;User ID=xxxx;password=xxxx"

conn.Open()

command = New SqlCommand(sqlAction)

'command.Parameters.AddWithValue("@.rating", rating)

command.Connection = conn

' Execute the command and send the results directly to the client

'SqlContext.Pipe.ExecuteAndSend(command)

Dim drUnitCode As SqlDataReader = command.ExecuteReader()

While drUnitCode.Read

If drUnitCode.Item("CompanyCode").ToString <> prevCompanyCode Then

agencySysNo = 0

If drUnitCode.Item("CompanyCode").ToString <> "" Then

agencySysNo = InsertAgency(drUnitCode.Item("CompanyCode").ToString, drUnitCode.Item("UC_DEPARTMENT_DESC").ToString, _

Convert.ToBoolean(drUnitCode.Item("NCAS")), drUnitCode.Item("UC_BILLING_CODE").ToString)

End If

End If

If agencySysNo > 0 Then

InsertDivision(agencySysNo, drUnitCode.Item("UC_DIVISION_DESC").ToString, drUnitCode.Item("UC_SHORT_DEPT_DIV").ToString, _

drUnitCode.Item("UC_CODE_NUMBER").ToString)

End If

prevCompanyCode = drUnitCode.Item("CompanyCode").ToString

End While

Catch ex As Exception

End Try

Thanks!

Error in Creating Stored Procedure from VS 2005

When I create a stored procedure in VS 2005 using C# and deploy it to the server I can't execute it there and here is the error message:

Msg 6522, Level 16, State 1, Procedure GetAll, Line 0

A .NET Framework error occurred during execution of user defined routine or aggregate 'GetAll':

System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

System.Security.SecurityException:

at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)

at System.Security.PermissionSet.Demand()

at System.Data.Common.DbConnectionOptions.DemandPermission()

at System.Data.SqlClient.SqlConnection.PermissionDemand()

at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)

at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)

at System.Data.SqlClient.SqlConnection.Open()

at StoredProcedures.GetAll()

and the code for creating the stored procedure is:

SqlConnection connDB = new SqlConnection(@."Initial Catalog=MDB;Data Source=Server1;");

SqlCommand cmd = new SqlCommand();

cmd.Connection = connDB;

cmd.CommandText = "SELECT * FROM Modifier";

connDB.Open();

SqlDataReader rdr = cmd.ExecuteReader();

SqlContext.Pipe.Send(rdr);

rdr.Close();

connDB.Close();

your help is appreciated...

What is the permission_set that you assigned for the assembly? This is the one in the CREATE ASSEMBLY. You need to set it to EXTERNAL_ACCESS due to use of SqlConnection that is accessing remote resource. Additionally, you will have to enable TRUST_WORTHY bit (use with care) or do the recommended key based login creation & assign external access assembly permission to it and use that user as owner of the assembly. If you download the new version of SQL Server 2005 Books Online it should contain updated topics that show how to do this. If you need some examples, please post back and I will try to locate a sample for you.|||

I am getting the same error when trying to debug my stored procedure. How do I get around int?

Here's my code:

Try

Dim conn As SqlConnection = New SqlConnection

conn.ConnectionString = "Data Source=XXX-XXXX\SQLSERVER2005;Initial Catalog=MotorFleetConversion;User ID=xxxx;password=xxxx"

conn.Open()

command = New SqlCommand(sqlAction)

'command.Parameters.AddWithValue("@.rating", rating)

command.Connection = conn

' Execute the command and send the results directly to the client

'SqlContext.Pipe.ExecuteAndSend(command)

Dim drUnitCode As SqlDataReader = command.ExecuteReader()

While drUnitCode.Read

If drUnitCode.Item("CompanyCode").ToString <> prevCompanyCode Then

agencySysNo = 0

If drUnitCode.Item("CompanyCode").ToString <> ""Then

agencySysNo = InsertAgency(drUnitCode.Item("CompanyCode").ToString, drUnitCode.Item("UC_DEPARTMENT_DESC").ToString, _

Convert.ToBoolean(drUnitCode.Item("NCAS")), drUnitCode.Item("UC_BILLING_CODE").ToString)

EndIf

EndIf

If agencySysNo > 0 Then

InsertDivision(agencySysNo, drUnitCode.Item("UC_DIVISION_DESC").ToString, drUnitCode.Item("UC_SHORT_DEPT_DIV").ToString, _

drUnitCode.Item("UC_CODE_NUMBER").ToString)

EndIf

prevCompanyCode = drUnitCode.Item("CompanyCode").ToString

EndWhile

Catch ex As Exception

EndTry

Thanks!

error in create subscription wizard

When creating a subscription, if there is an error detected at the end - it creates the subscription but might not create the sql agent job, and it doesn't give you a chance to correct the error.

e.g. in the Agent Process account I forgot to prefix the username with the domain

At the end of the wizard it told me of the error, created the subscription but didn't let me go back to correct the error (and it didn't create the sql agent job). In the end it was easier to delete the subscription and create it again.

Not the end of the world but hopefully the developers will fix this in time.

thanks
Bruce

Hi, Bruce,

I was able to reproduce the issue you described with the exception that in my case the subscription was not created when the security account is specified without domain prefix in new subscription wizard.

I've entered a bug in our bug database to track this issue.

Thanks for reporting this problem.

Zhiqiang|||I'm following the steps of sample SQL Server Mobile Tutorials..
error on my replication subscription wizard :
"Initialiazing SQL Server Reconciler has failed
HRESULT 0x80045003 (29045)

The initial snapshot for publication 'SQLMobile' is not yet available. Start the Snapshot Agent to generate the snapshot for this publication. If this snapshot is currently being generated, wait for the process to complete and restart the syncronization.
HRESULT 0x80045003 (0)"

error while waiting synchronizing Data in New Subcription Wizard!!
anyone can help?how to solve this problem?

error in create subscription wizard

When creating a subscription, if there is an error detected at the end - it creates the subscription but might not create the sql agent job, and it doesn't give you a chance to correct the error.

e.g. in the Agent Process account I forgot to prefix the username with the domain

At the end of the wizard it told me of the error, created the subscription but didn't let me go back to correct the error (and it didn't create the sql agent job). In the end it was easier to delete the subscription and create it again.

Not the end of the world but hopefully the developers will fix this in time.

thanks
Bruce

Hi, Bruce,

I was able to reproduce the issue you described with the exception that in my case the subscription was not created when the security account is specified without domain prefix in new subscription wizard.

I've entered a bug in our bug database to track this issue.

Thanks for reporting this problem.

Zhiqiang|||I'm following the steps of sample SQL Server Mobile Tutorials..
error on my replication subscription wizard :
"Initialiazing SQL Server Reconciler has failed
HRESULT 0x80045003 (29045)

The initial snapshot for publication 'SQLMobile' is not yet available. Start the Snapshot Agent to generate the snapshot for this publication. If this snapshot is currently being generated, wait for the process to complete and restart the syncronization.
HRESULT 0x80045003 (0)"

error while waiting synchronizing Data in New Subcription Wizard!!
anyone can help?how to solve this problem?

Error in create sp

hi every one

when i want to create a stored procedure that contain character " with a ado component , i receive this error message :

'Parameter object is improperly defined. inconsistent or incomplete information was provided.'

but if i create this procedure from query analyzer , this sp creates successfuly.

whyyyyyyyyyyyyyyyy? :mad:My guess would be that the client side (probably VB) code doesn't properly escape the quotation mark, and since the Transact-SQL doesn't need to escape the quote it isn't a problem there. I'd suggest that you post the VB code you are using so that we can see if that is your problem.

-PatP|||It's the QUOTED_IDENTIFIER setting on connection object vs. your QA. On the client side set this setting to be the same as in QA (in Connection Options menu item in QA).

Error in connecting to SQL Server Express

Hello,

I'm a newbie who is trying to create a connection to the server in my website application and I keep getting the following error: An error has occurred while establishing 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server). I enabled TCP/IP and Pipe in the configuration and restarted the engine and server but I still get this error and it's stressing me out. Below is the code for the app. Any help would be greatly appreciated. Thanks

Imports

System.Data

Imports

System.Data.SqlClient

Partial

Class _DefaultInherits System.Web.UI.PageProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.Load' Create the database ConnectionDim connAsNew System.Data.SqlClient.SqlConnection( _"Server=Main;" + _"Integrated Security=True;" + _"Database=ShoppingCartData;" + _"AttachDBFilename=" + _"C:\DOCUMENTS AND SETTINGS\TONYA\MY DOCUMENTS\VISUAL STUDIO 2005\WEBSITES\ADO\APP_DATA\ADO.MDF")

' Create the Data Adapter with the required SELECT statementDim AdaptAsNew System.Data.SqlClient.SqlDataAdapter("SELECT * FROM Products", conn)' Create the dataset with the required informationDim dsADOAsNew System.Data.DataSet()

Adapt.Fill(dsADO)

Dim DRAs DataRow()' Define the TableDim ProdTblAsNew Table()' Create content for the Web PageForEach DRIn dsADO.Tables(0).Rows'Create a new table row.Dim ProdRowAsNew TableRow()'Create a cell within the row.Dim ProdCellAsNew TableCell()'Define content for the CellDim ThisLinkAsNew HyperLink()

ThisLink.NavigateUrl =

"Products.aspx?ProdID=" + _

DR(

"ProductID").ToString()

ThisLink.Text = DR(

"ProductNme").ToString()

ThisLink.ID = DR(

"ProductID").ToString()'Add the content to the cell and the cell to the row. Place the row in the table

ProdCell.Controls.Add(ThisLink)

ProdRow.Controls.Add(ProdCell)

ProdTbl.Controls.Add(ProdRow)

Next'Add the table to the Place holder.

phProducts.Controls.Add(ProdTbl)

EndSub

End

Class

That SQL Server Express instance must be local to connect to it. If it is locally installed just try changingServer=(local) to your connection.

Thanks

|||

Thank you for your reply. I have changed this as you've instructed, but it is still not working.

Thanks

|||

Hi,

Is this SQL Server on your local machine? If not, can you connect from the local one?

Also, you can test with a .UDL file. Here are the steps to create one.

1. Create a .txt file on desktop and rename it to .UDL.
2. Double click on the file and a Data Link Properties dialog box will appear.
3. You can test with this dialog box to see if it works fine on both remote and local machine.

error in calculated member

hi,

i want to create a calculated field in Analysis Services. But when I click on the Calculations tab, I get an error "Unexpected error occurred: 'Error in the application".

What seems to be the problem?

cherrie

Check the Calculate Script is properly there.

/*-- Aggregate leaf data --*/
Calculate

Thanks
Imran|||

hi,

sorry im new to this, how do i check that...

thanks!

cherrie

|||

Dear Friend,

Do you still have the error?

Regards!

|||

Hi,

Solved already.just versioning on dll.

Thanks!

|||

Cherriesh,

When you resolve your problem with or without support of the comunity, always check the answer as resolved!

Thanks and I happy that you get it!

Regards!!