Invalid Pointer When Using Ado In A Dll

Nov 5, 2007

Hello, I am working on a dll that is being loaded by browsers. I have to check if the hostname of a requested page is in a database containing sites that have to be blocked. I am using the following code to connect to the db:


Code Block


BOOL check(WCHAR *wszHost)
{
BOOL ret = FALSE;
_ConnectionPtr pConn = NULL;
_CommandPtr pCmd = NULL;
_RecordsetPtr pRs = NULL;
try
{
pConn.CreateInstance(__uuidof(Connection));
pCmd.CreateInstance(__uuidof(Command));
pRs.CreateInstance (__uuidof (Recordset));
pConn->Open(_bstr_t(L"Provider=MSDASQL.1;Data Source="C:\Deny.mdb"), _bstr_t(L""), _bstr_t(L""), adOpenUnspecified);
pCmd->ActiveConnection = pConn;
pCmd->CommandType = adCmdText;
wcscpy_s(query, 2*_MAX_PATH, L"SELECT site FROM Allow WHERE site='");
wcscat_s(query, 2*_MAX_PATH, wszHost);
wcscat_s(query, 2*_MAX_PATH, L"'");
pCmd->CommandText = (_bstr_t)query;
pRs->CursorLocation = adUseClient;
pRs->Open((IDispatch*)pCmd, vtMissing, adOpenStatic, adLockReadOnly, adCmdText);
if(pRs->RecordCount > 0)
ret = TRUE;
}
catch(_com_error error)
{
dbgprint(" Description = %s
", (char*) error.Description());
dbgprint(" Source = %s
", (char*) error.Source());
dbgprint(" Code = %08lx
", error.Error());
dbgprint(" Code meaning = %s
", error.ErrorMessage());
return FALSE;
}
catch(...)
{
dbgprint(" Unhandled error!");
return FALSE;
}
}

Hel

The strange thing is that this code is running fine with Internet Explorer but when the dll is loaded by Firefox pConn->Open() fails with Invalid pointer error. Any suggestions will be greatly appreciated. Thank you.Martin

View 1 Replies


ADVERTISEMENT

HELP!!! DTS: Invalid Pointer Error

Aug 31, 1999

I searched the archives but couldn't find anything on this yet...

I am using the wizard to grab selected data from 6.5 Server1 to insert into a table on 6.5 Server2, no transformations necessary.

I've tried it two ways (actually more, but two ways will demonstrate the problem). The query I run to grab the data is search through approx 6.5 million records in poorly indexed tables, on a slow machine. Takes approximately 45 minutes to run the query alone, and right around the same to run the DTS package.

The difference between the two queries in the two different packages (all else equal), is that the first uses a variable to calculate a date to filter the where clause. The second hard codes the date in the where clause. The second works, but the first runs about 40 minutes before returning a Transfer Failed error that reads "Invalid Pointer". No error number, nothing in the Books online about the error.

The queries are as follows:
***************************************
QUERY 1 (calculates the date for 11:00 PM night before last)

Declare @DateLastReceived datetime
Declare @CharLastReceived varchar(25)

Select @DateLastReceived = DateAdd(dd,-1,getDate())
Select @CharLastReceived = Convert(varchar(25), @DateLastReceived, 101)
select @DateLastReceived = Convert(dateTime, @CharLastReceived)
select @DateLastReceived = DateAdd(hh,-1,@DateLastReceived)

select s.SerialNumber as iwSerialNumber, MAX(p.ReceiptTime) AS iwLastReceived,
p.PurchaseOrderNumber as iwPO, s.Revision as iwBomRev, s.PartNumber as iwPartNumber
From SLOCAZ s INNER JOIN PORDRZ p ON s.SerialNumber = p.SerialNumber
Where p.ReceiptTime > @DateLastReceived
And ( (p.PurchaseOrderNumber Like 'BD%')
OR (p.PurchaseOrderNumber Like 'TP%')
OR (p.PurchaseOrderNumber Like 'DM%') )
GROUP BY s.SerialNumber, p.PurchaseOrderNumber, s.Revision, s.PartNumber

***************************************
QUERY 2 (Hard codes the date)

select s.SerialNumber as iwSerialNumber, MAX(p.ReceiptTime) AS iwLastReceived,
p.PurchaseOrderNumber as iwPO, s.Revision as iwBomRev, s.PartNumber as iwPartNumber
From SLOCAZ s INNER JOIN PORDRZ p ON s.SerialNumber = p.SerialNumber
Where p.ReceiptTime > 'Aug 29 1999 11:00PM'
And ( (p.PurchaseOrderNumber Like 'BD%')
OR (p.PurchaseOrderNumber Like 'TP%')
OR (p.PurchaseOrderNumber Like 'DM%') )
GROUP BY s.SerialNumber, p.PurchaseOrderNumber, s.Revision, s.PartNumber

*****************************
I should also note that I thought maybe the hard coded date being used as a string was the difference, so I tried the following (which just converts the date back into a char variable and uses the char variable in the where clause)

Declare @DateLastReceived datetime
Declare @CharLastReceived varchar(25)

Select @DateLastReceived = DateAdd(dd,-1,getDate())
Select @CharLastReceived = Convert(varchar(25), @DateLastReceived, 101)
select @DateLastReceived = Convert(dateTime, @CharLastReceived)
select @DateLastReceived = DateAdd(hh,-1,@DateLastReceived)
select @CharLastReceived = Convert(varchar(25), @DateLastReceived, 100)

select s.SerialNumber as iwSerialNumber, MAX(p.ReceiptTime) AS iwLastReceived,
p.PurchaseOrderNumber as iwPO, s.Revision as iwBomRev, s.PartNumber as iwPartNumber
From SLOCAZ s INNER JOIN PORDRZ p ON s.SerialNumber = p.SerialNumber
Where p.ReceiptTime > @CharLastReceived
And ( (p.PurchaseOrderNumber Like 'BD%')
OR (p.PurchaseOrderNumber Like 'TP%')
OR (p.PurchaseOrderNumber Like 'DM%') )
GROUP BY s.SerialNumber, p.PurchaseOrderNumber, s.Revision, s.PartNumber

************************************
This still didn't work...

Any Ideas on what is happening and/or how to fix it???
Amy

View 1 Replies View Related

I Want To Connect To A Ms Sql Server,but ...invalid Pointer...why?

Dec 28, 2004

i want to conncet to a ms sql server,but the debug info: "invalid pointer!"
is there any problems in my coding?
by debugging, i know the problem must lie in the variant strConnect.
i use ms sql server 2000+ winxp+ visual c++6.0

_ConnectionPtr m_pConnection ;
void ADOConn::OnInitADOConn()
{
::CoInitialize(NULL);
try
{
m_pConnection.CreateInstance("ADODB.Recordset");

_bstr_t strConnect="Provider=SQLOLEDB;
TRUSTED_CONNECTION=TRUE;//use windows log in
Initial Catalog=....../*database name*/;
Data Source=SJTU-3V87CA6SZP";//server name
m_pConnection->Open(strConnect,"","",adModeUnknown);


}
catch (_com_error e) {
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
TRACE( "Exception thrown for classes generated by #import" );
TRACE( " Code = %08lx", e.Error());
TRACE( " Code meaning = %s", e.ErrorMessage());
TRACE( " Source = %s", (LPCTSTR) bstrSource);
TRACE( " Description = %s", (LPCTSTR) bstrDescription);
}
}

View 2 Replies View Related

Invalid Pointer Error Using DTS Package

Apr 17, 2008

Hi,

While executing a task in DTS package I found an error as Invalid Pointer.

SQL statement in Source of Transform Data Task Properties is :

Delete From TableName Where column in (Select * from Table Where Condtion2)
Select * from Table

and in Description field as :

Copy Data From [DB].[dbo].[Table] to [DMIS].[dbo].[TableName] Task

Destination table is :
TableName

Pls let me know how to rectify this Error.

Regards,

Srinivas Alwala

View 1 Replies View Related

Change ODBC Pointer On Workstations After Database Move

Jul 23, 2005

I am by no means a "Database Expert" and have recently been asked toassist with a SQL 2000 database move to a new server. I was wonderingif there was an easy way to reconfigure the ODBC pointers on theworkstations?Thanks for the help in advance.

View 1 Replies View Related

Integration Services :: Use Of Pointer In Data Flow Task

May 9, 2012

I'm a beginner in ssis. Use of Pointer in Data Flow task (Transformations)Royal PS

View 11 Replies View Related

SQLDescribeParam With Subselect: Invalid Parameter Number/Invalid Descriptor Index

Apr 21, 2008

Hello,

I've got the following query:

SELECT zA."ID" AS fA_A
, zA."TEXT" AS fA_B
, (
SELECT COUNT(zC."ID")
FROM Test."Booking" AS zC
) AS fA_E
FROM Test."Stack" AS zA
WHERE zA."ID" = ?

With this query I call:
- SQLPrepare -> SQL_SUCCESS=0
- SQLNumParams -> SQL_SUCCESS=0, pcpar = 1
- SQLDescribeParam( 1 ) -> SQL_ERROR=-1, [Microsoft][ODBC SQL Server Driver]Invalid parameter number", "[Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index"

Is there a problem with this calling sequence or this query? Or is this a problem of SQL Server?

Regards
Markus

View 7 Replies View Related

Invalid Value For Key 'attachdbfilename'.

Nov 8, 2006

HI,
 We upgraded to SQL Server 2005 Standard Edition for our ASP.NET 2.0 website.  We were using SQL Server Express 2005.  That worked fine.  Now we are unable to connect to the database.  I have googled, but I just cann't figure out what is going on.  Any help is appreciated.  Here is the 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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
In our firewall sqlbrowser.exe and sqlservr.exe are allowed.
Thanks Matt

View 11 Replies View Related

Invalid Object Name

Sep 27, 2007

Ok I'm trying to connect to my easycgi.com MSSQL database.I can connect OK.My ID is in the db_owner group.I can create and edit tables and data.I can open a table and see the data.I can view the SQL statement behind the open table (select * from Table) and execute it successfully.But if I open a new query window and type "select * from [table]" (or any other query), no matter which table it is, I get an error:Msg 208, Level 16, State 1, Line 1Invalid object name '[table name]'.I've searched the web and found this error plenty of times, usually associated with security or the schema. But all my objects are under dbo and I'm in db_owner... ??? 

View 6 Replies View Related

Invalid Connection

Jun 19, 2008

When trying to connect to a remote SQL 2005 Express Server, I get this error message:  [DBNETLIB][ConnectionOpen (ParseConnectParams()).]Invalid connection.
 I can remotely connect to the server with the same username and password using osql in command and I can also connect to the server remotely with SQL Server Management Studio installed on this machine.
 Here is my connection string:
 Provider=SQLOLEDB.1;Password=password;Persist Security Info=True;User ID=uid;Initial Catalog=EBM;Data Source=xxx.xxx.xxx.xxxSQLEXPRESS;Use Encryption for Data=False
 The same connection string works if connecting locally, via changing the ip address to the machine name:
Provider=SQLOLEDB.1;Password=password;Persist Security Info=True;User ID=uid;Initial Catalog=EBM;Data Source=machinenameSQLEXPRESS;Use Encryption for Data=False
 
Any help would be appreciated.

View 2 Replies View Related

Invalid Column Name

Mar 19, 2004

I get a Invalid Column Name ' '. with this procedure. Can anyone see what migh be wrong?

Thanks,

SELECT A.CompanyName,C.FirstName,C.LastName,C.Client_ID,
CASE WHEN A.[CompanyName] IS NULL OR A.[CompanyName] = '' THEN C.[FirstName] +" "+ C.[LastName] ELSE A.[CompanyName] END AS DRName, C.Client_ID
FROM tblClients C INNER JOIN tblClientAddresses A ON C.Client_ID = A.Client_ID
WHERE (C.Client_ID = 15057) AND (A.MailTo=1) AND Convert(varchar(5), GETDATE(), 10) BETWEEN Convert(varchar(5), A.Startdate, 10) AND Convert(varchar(5), A.Enddate, 10) OR (A.Startdate Is Null) AND (A.EndDate Is Null)
GO

View 3 Replies View Related

Invalid Column Name

Aug 19, 2004

Hi the following SP that causes an error.



CREATE PROCEDURE GetInfo
(
@MinPriceint=0,
@MaxPriceint=9999999999,
@TypeHomenvarchar(50)=NULL,
@Locationnvarchar(100)=NULL

)
AS

Declare @strSql nvarchar(255)
Set @strSql="Select * from table WHERE "
Set @strSql=@strSql + 'Price BETWEEN ' + CONVERT(nvarchar(20),@MinPrice) + ' and ' + CONVERT(nvarchar(20),@MaxPrice )

If @TypeHome != "No Preference"
Set @strSql=@strSql + ' and Type = ''' + @TypeHome+ ''''

If @Location != "No Preference"
Set @strSql=@strSql + ' and City = ''' + @Location+ ''''

Set @strSql=@strSql + ' and IDX = ''Y'' ORDER BY Price'
Exec(@strSql)
GO



The Error I get is:
"Error 207: Invalide Column Name 'Select * from table WHERE'
Invalid Column Name 'No Preference'
Invalid Column Name 'No Preference'

I have checked the table and the columns do exist, spelled correctly and caps are all the same. Also, this same SP in another table works just fine.

What is causing this error?

Thanks in advance!

View 1 Replies View Related

Invalid Connection

Mar 30, 2005

Hey everyone, hope you all can help me with this problem. 
We have a remotely hosted website, but we have a SQL server in our company (powers our instore portal).  I have set up our router so that i can connect to remote desktop and sql server.  I can connect to the remote desktop and i can connect to the sql server with query analyzer.  On our local site i can set up a connection to look at sqlserver.underpargolfutah.org and it works fine, everything goes well.
Now here is the problem.  On the hosted site i have set up the following
web.config >
<appSettings>
      <add key="sql_dsn" value="server=************.underpargolfutah.org;database=online;uid=sa;pwd=*******" />
</appSettings>
default.aspx >
Public Class shopDB   'publicly declare typical stuff for connections   Public conn As SqlConnection   Public cmd As SqlCommand   Public reader As SqlDataReader   Public dsn As String = ConfigurationSettings.AppSettings("sql_dsn").ToString   Public Function getBaseSelectionsByType(ByVal type)   'declare the connection   conn = New SqlConnection(dsn)   'declare command   cmd = New SqlCommand("SELECT * FROM category", conn)   'open the connection   conn.Open()   'grab data   reader = cmd.ExecuteReader(CommandBehavior.CloseConnection)   Return reader   End Function
End Class
This should all work but i get the following error
[SqlException: Invalid connection.]   System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +474   System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372   System.Data.SqlClient.SqlConnection.Open() +384   v3.shopDB.shopDB.getBaseSelectionsByType(Object type) in shopDB.vb:21   v3.shop_default.Page_Load(Object sender, EventArgs e) in default.aspx.vb:32   System.Web.UI.Control.OnLoad(EventArgs e) +67   System.Web.UI.Control.LoadRecursive() +35   System.Web.UI.Page.ProcessRequestMain() +742Any ideas? i am stumped.
Thanks in advance-Darren

View 1 Replies View Related

Invalid Column Name &#39;x&#39;

Feb 16, 2001

Can anyone tell me why I get the above message using the following stored procedure and passing in a value of 120:
CREATE Procedure qryAnalysisCountMain
(@WizardGroup1Question int)
As
EXEC("SELECT QuestionDescription FROM Questions WHERE QuestionCode = " + @WizardGroup1Question)

120 just happens to be the asci value of 'x' and whatever number I pass in gets converted into it's character equivalent and the sp tells me it can't find that column name. QuestionCode is an int field so there is no problem there

The procedure works OK with:
SELECT QuestionDescription FROM Questions WHERE QuestionCode = @WizardGroup1Question

However I need the SQL in an EXEC as the sp will eventually be dynamic so that i can pass in the name of the table to select from.

Thanks
Martin

View 1 Replies View Related

Invalid Column Name

Mar 30, 2004

Hi
I have a dynamic select statement which is showed below.
declare @query varchar(100)
set @query = 'select * from undergraduate where Gender =' + @Gender
exec (@query)

//
When I execute the @query, I get an error message like "Invalid Column Name Male".
I think I need to put a single quotation around the dynamic variable, so that I have
select * from undergraduate where Gender ='Male'. But I am not sure how to do that.

Thank you for your help!!

View 3 Replies View Related

Type Name Is Invalid

Jan 21, 2006

Dear guys

when am executing a stored procedure from asp page it will shows an err like this

"
Microsoft OLE DB Provider for SQL Server error '80040e30'

Type name is invalid
"
but the script and the database is perfectly working in local computer ..

what will be the reason.

regards jini

View 2 Replies View Related

Invalid Object

Jul 31, 2002

When running 'select * from <table> everyone gets 'invalid object' error. When they run 'select * from <database>.<objectowner>.<table> it works fine. This would lead one to believe that they're either not in their default database or that they don't own the objects. However this is not the case.

Why do they need to qualify everything if they're running from their own databaase, they own the object and they're logged in as the objectowner?

This was working fine one day but not the next. They connect using a DSN that's on a web server and they pass their login and password but not their database. I don't have this problem and can't duplicate anyone else's, but I'm not on the web server, I'm going directly to teh SQL server using Query Analyzer.

Any ideas??

View 1 Replies View Related

Invalid Object Name

Jul 12, 2005

I'm connecting to an SQL Server database through a Perl script (using Win32::ODBC). The connection seems to go through fine, as in, I get no errors. But even simple statements like "Select * from AccountTable" dont work. I get the error Invalid Object Name 'AccountTable'. The table exists and I even gave myself explicit permission for "SELECT" statements for that table.

Are there any other permissions that need to be set? The DSN defaults to the database that I need.

Any help would be most appreciated. I'm going mad here.
Thanks.
-Amrita

View 1 Replies View Related

Invalid Object Name

Feb 2, 2007

as i run my code (windows application) i get this error

Invalid object name 'dbo_TASk'.
Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 0, current count = 1.

/****** Object: Stored Procedure dbo.stp_per_task_by_system_sel Script Date: DATE ******/
IF EXISTS (SELECT *
FROM dbo.sysobjects
WHERE id = OBJECT_ID(N'[dbo].[stp_per_task_by_system_sel]')
AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE [dbo].[stp_per_task_by_system_sel]
GO

CREATE PROCEDURE dbo.stp_per_task_by_system_sel
(
@sys_id int
)
AS
--------------------------------------------------------------------------------
-- Created by : Jacco B
-- Date created : 1-febrauri-2007
--------------------------------------------------------------------------------
-- Description : deze stp haalt de specefieke taken van een geselecteerd systeem uit de database
--------------------------------------------------------------------------------
-- Test string : stp_per_task_by_system_sel 'var'
--------------------------------------------------------------------------------
-- Change Log : Date By Description
-- -------- ------ ------------------------------------
--
--------------------------------------------------------------------------------
BEGIN
SET NOCOUNT ON
--declaratie locale variabelen
DECLARE @error integer,
@object_name varchar(30)

--begin transactie
SELECT @object_name = object_name(@@procid)
BEGIN TRAN @object_name

--begin procedure
SELECT SYSTEM_STANDARD_TASK.*, TASk.*
FROM SYSTEM_STANDARD_TASK INNER JOIN dbo_TASk ON SYSTEM_STANDARD_TASK.tas_id = TASk.tas_id
WHERE SYSTEM_STANDARD_TASK.sys_id = @sys_id



--Errorafhandeling
SELECT @error = @@error
IF @error <> 0
BEGIN
ROLLBACK TRAN @object_name
RETURN @error
END

--commit transactie
COMMIT TRAN @object_name
RETURN 0
END

GO


--grant exec to sql group
GRANT EXECUTE ON [dbo].[stp_per_task_by_system_sel] TO [PERIODIEK_USER]
GO

View 2 Replies View Related

Invalid Object Name Please Help

Feb 4, 2005

When i enter http://akor.alternatifim.com/
i get the error below

Microsoft OLE DB Provider for ODBC Drivers error '80040e37'

[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'tblSARKICIM'.

The SQL statement is so simple like

Select * from tblSARKICIM

However when i change the SQL statement Select * from lyric.tblSARKICIM

lyric is username and owner of the tables.


Problem is solved. I transfer the My SQL Server and then this problem occurs and i don't want change all my SQL statements.

What can i do?

View 6 Replies View Related

Invalid Handle In MS SQL

Jul 9, 2006

Hi All,

We have got a new HP server and SQL is preinstalled, But when we are trying to start SQL, it gives an error "The handle is invalid".

We tried to reinstall the SQL, but , being a server t doesn't allow to do so

Please assist.

regards,

Jatin

View 1 Replies View Related

Invalid Object Name

Jul 16, 2007

Hi,
My application uses VB6 and Sql-Server 2000.
I can’t understand why the error
INVALID OBJECT NAME Run-time error '-2147217865 (80040e37)'
appears only sometimes and not always. For example, a select instruction is executed inside a loop without any problem 1 thousand times, then when I try to execute it 1 thousand times and one, it fails.


Have you got any suggestions?

I’ve read a lot of posts on Internet Forums, without finding any solutions.

In the mail I attach, you can see that the application stops at 79%, after having executed many times the select instruction without any problem!


Thank you very much for your help!

Bye,

Emanuela

View 7 Replies View Related

Invalid Use Of Null

Dec 29, 2003

I am getting the "Invalid use of Null" message when I execute the following code under the following conditions.

fields in SQL Server table
db_date varchar(30) --> "December 29"
db_subject varchar(200) --> "Test Subject"
db_thought text --> "This is a test to see if this works"

I execute the following code from VB6

strText = "select * from db_table where db_date = 'December 29'"
ors.open strText, dbConnect
if not ors.eof then
if not isnull(ors("db_thought")) then
txtBox1 = ors("db_thought")
end if
end if

Here is my problem. Since there is a value in db_thought the code if not isnull(ors("db_thought")) evaluates to true -- this is what I expect. However when I try to assign the ors("db_thought") to the txBox1 field I get an Invalid use of Null. What am I missing?

Thanks

View 2 Replies View Related

Invalid Object Name

Feb 9, 2004

I restored all Databases in other server.

First I restored the master database and after the others databases. But when I connect by Query Analyser with a user that is a DBO and I execute a select the system return : "Invalid object name 'XXXX'"

My MS-SQL is the version 7.0.

View 1 Replies View Related

Invalid Object Name - Grr...

Mar 3, 2004

This is what I have. It works fine until I get to the select statement, then it tells me that I have an invalid object name. What am I missing? Thanks!

DECLARE @SvrName varchar(100)

if @@SERVERNAME='pubs' begin
set @SvrName=’pubs.books.isbn’
print @SvrName
end
if @@SERVERNAME='MGMFILENET' begin
set @SvrName=’store.books.isbn’
print@SvrName
end

print @@SERVERNAME
PRINT @SvrName
SELECT * FROM "@SvrName"

View 7 Replies View Related

Invalid Row Count

Mar 19, 2004

Hi,

I am building a shopping cart program, complete with an admin back end.
I am using ASP.NET, VB. NET and a SQL SERVER 2000 database.

The cart is working well... items can be added, updated and removed. However when trying to access the orders stored in the database from the admin section of the application, I am getting an "invalid record count" error.

I have no idea what this means. I've tried looking it up online, but so far no luck.

The orders are being stored in two tables connected via a foreign key.
I have no problem writing to the tables, it's just a problem reading the tables. I have dropped the two tables twice and rebuilt them, but I get the same error each time.

Any thoughts on what is causing this error?

Thanks,

-Michael

View 2 Replies View Related

Invalid Object Name

Apr 2, 2004

I am getting an error 'Invalid Object Name' when I try and insert a row yet I can query the same table and get results????

Please Help!

View 7 Replies View Related

Invalid Column

May 6, 2008

Hello All,

I m facing problem in one query. What I did is

SELECT
PRODUCT_ID,
PRODUCT_END_DATE,
CASE
WHEN PRODUCT_ID = 1 THEN DATEADD(YY,-5,PRODUCT_END_DATE)
WHEN PRODUCT_ID = 2 THEN DATEADD(YY,-10,PRODUCT_END_DATE)
WHEN PRODUCT_ID = 3 THEN DATEADD(YY,-15,PRODUCT_END_DATE)
END AS MODIFIED_END_DATE
FROM PRODUCTS
WHERE MODIFIED_END_DATE BETWEEN '2008-04-01' AND '2008-04-30'

when I execute this query returns an error as
Invalid column name MODIFIED_END_DATE

So how can I write this query? any idea.

Thanks in advance.



--kneel

View 3 Replies View Related

Invalid Column Name But Right

Jun 16, 2008

I have my column names right but its telling me they are invalid. It must be something to do with how I have my subquery formatted but I don't see it. I was wondering if anyone else can see it? It tells me payer_id is not right and I know its coming from the bolded section. I just added that line to do some additional grouping. I know that the query above aliased as D was working before I put the bolded line in. Am I setting this up wrong?


select distinct c.description,tmp.person_id,tmp.person_nbr,tmp.first_name,
tmp.last_name,tmp.date_of_birth,d.payer_name,b.create_timestamp
from PersonMIA tmp
join person a on a.person_id = tmp.person_id
join patient_encounter b on a.person_id = b.person_id
join provider_mstr c on b.rendering_provider_id = c.provider_id
cross apply(select top 1 payer_name
from person_payer
where person_id = tmp.person_id
order by payer_id) d
join payer_mstr e on d.payer_id = e.payer_id
join mstr_lists f on e.financial_class = f.mstr_list_item_id
where c.description = 'Leon MD, Enrique'
group by c.description,tmp.person_id,tmp.person_nbr,tmp.first_name,tmp.last_name,
tmp.date_of_birth,d.payer_name,b.create_timestamp
)tmp2
where year(create_timestamp) IN (2005,2006)
group by person_nbr,payer_name,first_name,last_name,description,create_timestamp

Thanks in Advance!
Sherri

View 2 Replies View Related

Invalid Use Of Null

Oct 15, 2005

Hi

Please help how to solve the invalid use of Null value in numeric field

1. Query name : Genled
----------------------
SELECT PARTY.PARTYNAME AS PARTYNAME, GEN.GLNAME AS GLNAME,
GEN.AMOUNT AS OAMOUNT, CASH.CASHNAME AS CASHNAME, TXN.CBCODE AS CBCODE,
GEN.CB AS CB, TXN.GLCODE AS GLCODE, TXN.VOUCHER AS VOUCHER,
TXN.DOCDATE AS DOCDATE, TXN.AMOUNT AS TAMOUNT, TXN.VTYPE AS VTYPE,
TXN.NARR AS NARR, TXN.CHEQUE AS CHEQUE, TXN.CHEQDATE AS CHEQDATE,
TXN.BANK AS BANK, TXN.BILLNO AS BILLNO, TXN.BILLDT AS BILLDT
FROM PARTY RIGHT JOIN (GEN LEFT JOIN (TXN LEFT JOIN CASH ON TXN.CBCODE
= CASH.CBCODE) ON GEN.GLCODE = TXN.GLCODE) ON PARTY.PARTYCODE =
TXN.PARTYCODE WHERE (((GEN.GLCODE) Not In (SELECT CASHCODE FROM CASH)));


2. From query 1 i have to create temporary table ogenled & generalled

3. From table ogenled i have pass this query -
select glname, oamount, sum(tamount) as tamt,
(oamount+sum(tamount))as opbal from ogenled group by glname,
oamount order by glname

4. from query 3 i have update generalled table for opbal
but the problem is this if only oamount is <>0 and tamt is empty
then error message show "INVALID USE OF NULL"

5. gen table contain the glname, oamount , txn table contains the detail
transaction. It is quite possible that only opening amt is exit.
by query it nothing transaction is done than tamount field show " "

6. Please help how to show the default value 0 insted of " "


Thanks

ASM

View 7 Replies View Related

Invalid Column Name

Mar 26, 2006

I am building a query and thought I had completed it but I get 'Invalid Column Name "A1" when I run it?
SELECT
Groups.GroupID,
Sum(Stages_On_Route.Distance) AS Miles_Covered,
Groups.Group_Name
FROM Groups
INNER JOIN ((Route INNER JOIN Departure ON (Route.GroupID=Departure.GroupID)
AND (Route.RouteID=Departure.RouteID))
INNER JOIN Stages_On_Route ON Route.RouteID=Stages_On_Route.RouteID)
ON Groups.GroupID=Departure.GroupID
GROUP BY Groups.GroupID,
Groups.Group_Name
HAVING (((Groups.GroupID)="A1"));

View 6 Replies View Related

Invalid Syntax

Aug 10, 2006

Im 3 months into building a web page for my company. I want to insert and update data into the data base, but i keep getting this error message (Incorrect syntax near 'nvarchar') I have no programing experience and I dont understand the stack trace. Im using visual web developer which comes with sql express. Here is all the code. Thank you all for any help offered.
jdslim

Incorrect syntax near 'nvarchar'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near 'nvarchar'.
Stack trace

[SqlException (0x80131904): Incorrect syntax near 'nvarchar'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +95
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +82
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +346
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +3244
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +186
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1121
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +334
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +407
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +149
System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +493
System.Web.UI.WebControls.SqlDataSourceView.ExecuteInsert(IDictionary values) +551
System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) +173
System.Web.UI.WebControls.DetailsView.HandleInsert(String commandArg, Boolean causesValidation) +628
System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +745
System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source, EventArgs e) +162
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source, EventArgs e) +117
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +107
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +175
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +244
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3837


Source code For web page

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="Supplier" DataSourceID="SqlDataSource1" Height="50px" Style="z-index: 100; left: 333px;
position: absolute; top: 264px" Width="125px">
<Fields>
<asp:BoundField DataField="Supplier" HeaderText="Supplier" ReadOnly="True" SortExpression="Supplier" />
<asp:BoundField DataField="Variety" HeaderText="Variety" SortExpression="Variety" />
<asp:BoundField DataField="Arrival Date" HeaderText="Arrival Date" SortExpression="Arrival Date" />
<asp:CommandField ShowInsertButton="True" />
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>" DeleteCommand="DELETE FROM [Table1] WHERE [Supplier] = @original_Supplier AND [Variety] = @original_Variety AND [Arrival Date] = @original_Arrival_Date"
InsertCommand="INSERT INTO [Table1] ([Supplier], [Variety], [Arrival Date]) VALUES (@Supplier, @Variety, @Arrival_Date)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [Table1]"
UpdateCommand="UPDATE [Table1] SET [Variety] = @Variety, [Arrival Date] = @Arrival_Date WHERE [Supplier] = @original_Supplier AND [Variety] = @original_Variety AND [Arrival Date] = @original_Arrival_Date">
<DeleteParameters>
<asp:Parameter Name="original_Supplier" Type="String" />
<asp:Parameter Name="original_Variety" Type="String" />
<asp:Parameter Name="original_Arrival_Date" Type="DateTime" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Variety" Type="String" />
<asp:Parameter Name="Arrival_Date" Type="DateTime" />
<asp:Parameter Name="original_Supplier" Type="String" />
<asp:Parameter Name="original_Variety" Type="String" />
<asp:Parameter Name="original_Arrival_Date" Type="DateTime" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="Supplier" Type="String" />
<asp:Parameter Name="Variety" Type="String" />
<asp:Parameter Name="Arrival_Date" Type="DateTime" />
</InsertParameters>
</asp:SqlDataSource>

</div>
</form>
</body>
</html>

View 3 Replies View Related

Invalid Table Name

Dec 1, 2006

Good evening,

I have created a table named Student and i get the error:invalid table name.
I have changed it many times (like st,stud)and i get the same error.


What shall i do now?

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved