Re: Error Message could not find a non-generic method

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Jialiang,

It works,

Thank you very much for your help.

Do you think that the rest of the code wil work (Insert and Delete methods)?

Oded Dror



"Jialiang Ge [MSFT]" <jialge@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:yHN7fmwkIHA.360@xxxxxxxxxxxxxxxxxxxxxxxxx
Hello Ed,

I have tested your code carefully, and find a problem in UpdateProduct
function. The code line

cmd.Parameters.AddWithValue("@Crtd", CrtdUser)

should be

cmd.Parameters.AddWithValue("@CrtdUser", CrtdUser)

otherwise, it will throw an exception "Must declare the variable
'@CrtdUser'" when we click on Update button.

However, fixing this does not explain why you get the exception "could not
find a non-generic method". Based on my best, your code runs very well on
my side. I attach my test project 41722685.zip to this message. You can
download it with Windows Mail or Outlook Express. In my test project, I
removed DeleteVendor, InsertVender and the DetailView so that we can focus
on the UpdateProduct procedure. To create the Vendor table, I use the SQL
script:

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Vendor](
[Vendor_ID] [int] IDENTITY(1,1) NOT NULL,
[Vendor_Name] [nvarchar](50) NULL,
[Address1] [nvarchar](50) NULL,
[Address2] [nvarchar](50) NULL,
[City] [nvarchar](50) NULL,
[State] [nvarchar](50) NULL,
[Zip] [nchar](50) NULL,
[Phone] [nvarchar](50) NULL,
[Fax] [nchar](50) NULL,
[Email] [nchar](50) NULL,
[CrtdUser] [nchar](50) NULL,
[URL] [nvarchar](50) NULL,
CONSTRAINT [PK_tblVendor2] PRIMARY KEY CLUSTERED
(
[Vendor_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

I suggest you try my test project, and see if it works on your side, then
compare it with your solution, to narrow down focuses.

Regards,
Jialiang Ge (jialge@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx

This posting is provided "AS IS" with no warranties, and confers no
rights.
=================================================


.


Quantcast