Resolved.
Somehow the connectionstring was pointing to
initial catalog=master
I can't count how many times I checked the cs.
Grrrr.
Thx for the help.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Database:
aspnet-BorrowedLightImages2022-31ddfd69-3493-469b-8cb0-3f0d286226b2; (Name copied from connectionstring)
aspnet-BorrowedLightImages2022-31ddfd69-3493-469b-8cb0-3f0d286226b2 (Name copied from SSMS)
aspnet-BorrowedLightImages2022-31ddfd69-3493-469b-8cb0-3f0d286226b2 (Name copied from VS2022 Server Object Explorer)
contains a table, dbo.Image
SQL for that table:
CREATE TABLE [dbo].[Image] (
[Id] INT IDENTITY (1, 1) NOT NULL,
[ImgName] NVARCHAR (MAX) NOT NULL,
[ImgPath] NVARCHAR (MAX) NOT NULL,
[ImgKeywords] NVARCHAR (MAX) NOT NULL,
CONSTRAINT [PK_Image] PRIMARY KEY CLUSTERED ([Id] ASC)
);
Connection string
Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=aspnet-BorrowedLightImages2022-31ddfd69-3493-469b-8cb0-3f0d286226b2;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False
SQL INSERT statement that throws the error:
"INSERT INTO dbo.Image (ImgName, ImgPath, ImgKeywords) VALUES ('1.jpg','Images\Slider','')"
Exception message
Invalid object name 'dbo.Image'
The INSERT query runs fine in SSMS.
I've tried surrounding "dbo" and "Image" with brackets thusly:
[dbo].[Image]
``to no avail.
Resolved.
Somehow the connectionstring was pointing to
initial catalog=master
I can't count how many times I checked the cs.
Grrrr.
Thx for the help.