A
A
Andrey Fomin2021-06-06 13:56:48
SQL
Andrey Fomin, 2021-06-06 13:56:48

Where is the error in this SQL query?

Hello!
I am writing an application in C#, and it uses the following query:

$"SELECT * FROM Автомобиль WHERE VIN_номер = '{VIN.Text}' AND Номер_заказа= '{Nomer_zakaza.Text}' AND Номер_филиала = '{Nomer_filiala.Text}'"

And this error pops up:
"Invalid object name 'Car'."

What can be done about it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
d-stream, 2021-06-06
@d-stream

general, simple, how to understand it yourself:
string test = $" what I whine is fed
and look at the value of test with my eyes, or if it's not obvious, copy-paste the string into the sql console and get an error description from it.

A
Alexey Bereznikov, 2021-06-07
@gdt

It looks like the table name also needs to be enclosed in quotes.
https://stackoverflow.com/q/2901453/1828989 more information and examples here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question