Can Anyone Identify the cause of these errors?

greenspun.com : LUSENET : SQL Server Database Administration : One Thread

To anyone that can help,

Thanks in advance for your help. I am running into the following problems that are probably related.

First, I run the following VB Code:

Public OHadd As rdoQuery Dim OHeadrs As rdoResultset

Set OHadd = cn.CreateQuery("BHFOrderHead", _ "Select * from OrderHead where Donor = ? Order by OrderNumber") Set OHeadrs = OHadd.OpenResultset(rdOpenKeyset, rdConcurRowVer) With OHeadrs .AddNew !OrderDate = Form1.txtOrderDate.Text !ShipDate = Form1.txtShipDate.Text !donor = rs!donor !OrderTaker = Trim$(inRec.lDateTime) !ShippingTotal = inRec.SHTotal !GrandTotal = inRec.GrandTotal !Comments = Trim$(inRec.Comments) & " " & Trim$(inRec.Comments2) !PaymentType = UCase(Trim$(inRec.CreditCard)) !PaymentAcct = UCase(Trim$(NewCreditCardNumber)) !PaymentExpy = UCase(Trim$(inRec.ExpDate)) !PaymentBank = "UNKNOWN" '''The following line is the one that blows up .Update End With

The ".Update" line causes the following errors:

37000: [Microsoft][ODBC SQL Server Driver][SQL Server]Object 352004285 specified as a default for tabid 320004171, colid 7 is missing or not of type default. 223

37000: [Microsoft][ODBC SQL Server Driver][SQL Server]Bad pointer 0x2d09b20 encountered while remapping stored procedure 'DF_OrderHead_ItemTotal_4__10'. Must re-create procedure. 2805 ______________

Second, I run the following SQL query from ISQL:

select * from OrderHead where Donor = '%' Order by OrderNumber

And it returns the following error:

Msg 260, Level 16, State 1 Disallowed implicit conversion from datatype 'varchar' to datatype 'int' Table: 'BHF.dbo.OrderHead', Column: 'Donor' Use the CONVERT function to run this query.

HELP!!!!

Orrin R. Watson, Jr. likooid@aol.com orw1@midway.uchicago.edu

-- Anonymous, May 10, 1999

Answers

Orrin,

In your first question, I notice the code fragment, Select * from OrderHead where Donor = ? Order by OrderNumber. I think the question mark should be quoted.

The error 223 is trying to tell you that the value that you are assigning to the 7th column of the table with id = 320004171 is either missing or of the wrong type. To determine the table name you can run this SQL code in your database: select name from sysobjects where id = 320004171

The error 2805 is more of a problem. It happens sometimes when you have to recompile a stored procedure (probably due to a Microsoft bug). Hopefully, fixing the previous errors will prevent this problem.

The message 260 is telling you that the Donor column in the OrderHead table is not a character type. You will get this error if the Donor column is an int type, for instance.

Hope this helps,

Eric

-- Anonymous, May 10, 1999


Moderation questions? read the FAQ