Hi experts, I'm trying to access a UDT and display its contents in a DataGridView using C# in MSVS 2013. I have a successful connection to the database. The command
SELECT * FROM dbo.[@FOAMSPECS]
works from both SAP's Query Preview window and from the Microsoft SQL Server Management Studio's query window. So after much trying to correctly escape the brackets, I came up with this code snippet
OleDbDataReader dr;
string SqlCommand = "SELECT * FROM dbo.[[@FOAMSPECS]]]";
// Fill listbox with foam specs
OleDbCommand cmd = new OleDbCommand { CommandText = SqlCommand, Connection = cn };
try
{
dr = cmd.ExecuteReader();
}
catch (Exception ex)
{
MessageBox.Show("SQL Error ! " + ex.Message);
}
This seems to produce brackets in the right place in the select string but I get this error
What am I missing?