I got an exception when executing the SQL statement in my code below.
The error is "Invalid object name
'db_dynamic_tra ding.dbo.TrdRpt _broker_list'".
I know for a fact that 'db_dynamic_tra ding.dbo.TrdRpt _broker_list' is
valid, because I can run the same SQL statement in Management Studio
and it works.
Any advice on this? Is there anything wrong with my connection string
(although there is no complaint about the connection string in my
debugger)?
static void Main(string[] args)
{
string sConnectionStri ng = "Integrated
Security=SSPI;I nitial Catalog=db_dyna mic_trading;Dat a
Source=PANSQLDE V";
SqlConnection objConn = new
SqlConnection(s ConnectionStrin g);
objConn.Open();
string sSQL = "SELECT DISTINCT symbol_requeste d " +
"FROM
db_dynamic_trad ing.dbo.TrdRpt_ broker_list " +
"WHERE symbol_requeste d LIKE '%SCC%'";
SqlCommand objCmd = new SqlCommand(sSQL , objConn);
try
{
objCmd.ExecuteN onQuery();
}
catch (System.Excepti on e)
{
Console.WriteLi ne(e.Message);
}
Console.WriteLi ne("Records selected");
} 4 3345
On Aug 21, 10:58 am, Curious <fir5tsi...@yah oo.comwrote:
I got an exception when executing the SQL statement in my code below.
The error is "Invalid object name
'db_dynamic_tra ding.dbo.TrdRpt _broker_list'".
I know for a fact that 'db_dynamic_tra ding.dbo.TrdRpt _broker_list' is
valid, because I can run the same SQL statement in Management Studio
and it works.
Any advice on this? Is there anything wrong with my connection string
(although there is no complaint about the connection string in my
debugger)?
static void Main(string[] args)
{
string sConnectionStri ng = "Integrated
Security=SSPI;I nitial Catalog=db_dyna mic_trading;Dat a
Source=PANSQLDE V";
SqlConnection objConn = new
SqlConnection(s ConnectionStrin g);
objConn.Open();
string sSQL = "SELECT DISTINCT symbol_requeste d " +
"FROM
db_dynamic_trad ing.dbo.TrdRpt_ broker_list " +
"WHERE symbol_requeste d LIKE '%SCC%'";
SqlCommand objCmd = new SqlCommand(sSQL , objConn);
try
{
objCmd.ExecuteN onQuery();
}
catch (System.Excepti on e)
{
Console.WriteLi ne(e.Message);
}
Console.WriteLi ne("Records selected");
}
'db_dynamic_tra ding.dbo.TrdRpt _broker_list'
this table name looks funny, are you sure its correct?
also objCmd.ExecuteN onQuery(); is wrong.
Execute NON query is usually used for update or delete commands.
where is the result of your select statement going to be saved? you
need to have some object that will hold the result of your statement.
See below for example.
SqlCommand cmd = new SqlCommand("som e SELECT statement here", con);
cmd.CommandType = CommandType.Tex t;
SqlDataAdapter adp = new SqlDataAdapter( cmd);
DataSet ds = new DataSet();
adp.Fill(ds);
On Aug 21, 3:20*pm, rhaazy <rha...@gmail.c omwrote:
On Aug 21, 10:58 am, Curious <fir5tsi...@yah oo.comwrote:
I got an exception when executing the SQL statement in my code below.
The error is "Invalid object name
'db_dynamic_tra ding.dbo.TrdRpt _broker_list'".
I know for a fact that 'db_dynamic_tra ding.dbo.TrdRpt _broker_list' is
valid, because I can run the same SQL statement in Management Studio
and it works.
Any advice on this? Is there anything wrong with my connection string
(although there is no complaint about the connection string in my
debugger)?
* * * *static void Main(string[] args)
* * * * {
* * * * * * string sConnectionStri ng = "Integrated
Security=SSPI;I nitial Catalog=db_dyna mic_trading;Dat a
Source=PANSQLDE V";
* * * * * * SqlConnection objConn = new
SqlConnection(s ConnectionStrin g);
* * * * * * objConn.Open();
* * * * * * string sSQL = "SELECT DISTINCT symbol_requeste d " +
* * * * * * * * * * * * * "FROM
db_dynamic_trad ing.dbo.TrdRpt_ broker_list " +
* * * * * * * * * * * * * "WHERE symbol_requeste d LIKE '%SCC%'";
* * * * * * SqlCommand objCmd = new SqlCommand(sSQL , objConn);
* * * * * * try
* * * * * * {
* * * * * * * * objCmd.ExecuteN onQuery();
* * * * * * }
* * * * * * catch (System.Excepti on e)
* * * * * * {
* * * * * * * * Console.WriteLi ne(e.Message);
* * * * * * }
* * * * * * Console.WriteLi ne("Records selected");
* * * * }
'db_dynamic_tra ding.dbo.TrdRpt _broker_list'
this table name looks funny, are you sure its correct?
also objCmd.ExecuteN onQuery(); is wrong.
Execute NON query is usually used for update or delete commands.
where is the result of your select statement going to be saved? *you
need to have some object that will hold the result of your statement.
See below for example.
SqlCommand cmd = new SqlCommand("som e SELECT statement here", con);
* * * * * * * * cmd.CommandType = CommandType.Tex t;
* * * * * * * * SqlDataAdapter adp = new SqlDataAdapter( cmd);
* * * * * * * * DataSet ds = new DataSet();
* * * * * * * * adp.Fill(ds);- Hide quoted text -
- Show quoted text -
The table name is 'TrdRpt_broker_ list'. However, I must add the
database name plus 'dbo' before it
('db_dynamic_tr ading.dbo.TrdRp t_broker_list') ; otherwise, I'll get an
error about table not found.
I do need to return the records that return from the SELECT statement.
Thanks for the sample code. I'll give it a try.
On Aug 21, 5:15*pm, Curious <fir5tsi...@yah oo.comwrote:
On Aug 21, 3:20*pm, rhaazy <rha...@gmail.c omwrote:
On Aug 21, 10:58 am, Curious <fir5tsi...@yah oo.comwrote:
I got an exception when executing the SQL statement in my code below.
The error is "Invalid object name
'db_dynamic_tra ding.dbo.TrdRpt _broker_list'".
I know for a fact that 'db_dynamic_tra ding.dbo.TrdRpt _broker_list' is
valid, because I can run the same SQL statement in Management Studio
and it works.
Any advice on this? Is there anything wrong with my connection string
(although there is no complaint about the connection string in my
debugger)?
* * * *static void Main(string[] args)
* * * * {
* * * * * * string sConnectionStri ng = "Integrated
Security=SSPI;I nitial Catalog=db_dyna mic_trading;Dat a
Source=PANSQLDE V";
* * * * * * SqlConnection objConn = new
SqlConnection(s ConnectionStrin g);
* * * * * * objConn.Open();
* * * * * * string sSQL = "SELECT DISTINCT symbol_requeste d " +
* * * * * * * * * * * * * "FROM
db_dynamic_trad ing.dbo.TrdRpt_ broker_list " +
* * * * * * * * * * * * * "WHERE symbol_requeste d LIKE '%SCC%'";
* * * * * * SqlCommand objCmd = new SqlCommand(sSQL , objConn);
* * * * * * try
* * * * * * {
* * * * * * * * objCmd.ExecuteN onQuery();
* * * * * * }
* * * * * * catch (System.Excepti on e)
* * * * * * {
* * * * * * * * Console.WriteLi ne(e.Message);
* * * * * * }
* * * * * * Console.WriteLi ne("Records selected");
* * * * }
'db_dynamic_tra ding.dbo.TrdRpt _broker_list'
this table name looks funny, are you sure its correct?
also objCmd.ExecuteN onQuery(); is wrong.
Execute NON query is usually used for update or delete commands.
where is the result of your select statement going to be saved? *you
need to have some object that will hold the result of your statement.
See below for example.
SqlCommand cmd = new SqlCommand("som e SELECT statement here", con);
* * * * * * * * cmd.CommandType = CommandType.Tex t;
* * * * * * * * SqlDataAdapter adp = new SqlDataAdapter( cmd);
* * * * * * * * DataSet ds = new DataSet();
* * * * * * * * adp.Fill(ds);- Hide quoted text -
- Show quoted text -
The table name is *'TrdRpt_broker _list'. However, I must add the
database name plus 'dbo' before it
('db_dynamic_tr ading.dbo.TrdRp t_broker_list') ; otherwise, I'll get an
error about table not found.
I do need to return the records that return from the SELECT statement.
Thanks for the sample code. I'll give it a try.- Hide quoted text -
- Show quoted text -
you shouldn't need to include the database name as part of your
object. when you create your connection string the database should be
specified there.
string sSQL = "SELECT DISTINCT symbol_requeste d " +
"FROM
dbo.TrdRpt_brok er_list " +
"WHERE symbol_requeste d LIKE '%SCC%'";
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: rockie12 |
last post by:
I have a db that has a table x in it called data1
I have a program that does to things, updates values in the data1
table and also inserts new rows into this table. The update existing
values works great. Then when the insert loop runs, I get this error
on the following line.
insert into data1 ('AdminManageLogIn','Password') Values ('123','222')
Server: Msg 208, Level 16, State 1, Line 1
|
by: Glenn A. Harlan |
last post by:
Why am I receiving the below error when calling - Path.GetTempFileName()
The directory name is invalid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.IO.IOException: The directory name is invalid.
|
by: Frank Py |
last post by:
I'm getting the following error when trying an example app:
Invalid object name 'Products'.
Exception Details: System.Data.SqlClient.SqlException: Invalid object
name 'Products'.
Line 22: myCommand.Fill(ds)
Help appreciated. Thanks - Frank
<code>
|
by: Mr.KisS |
last post by:
Hello all,
I'm working with : WinXP PRO SP1, MS SQL 2005 Express,
Visual Web Dev 2005 Express.
I have an aspx page which must execute a stored procedure :
______________
try
{
myCommand.ExecuteNonQuery();
|
by: Jerry Nelson |
last post by:
I get the following error:
WGA_Update is a view not a Table
Invalid object name 'WGA_Update'.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Invalid object
| |
by: lds |
last post by:
I am getting the following error:
The "SendUsing" configuration value is invalid.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: The
"SendUsing" configuration value is invalid.
|
by: MR |
last post by:
I get the following Exception "The data at the root level is invalid. Line
1, position 642" whenever I try to deserialize an incoming SOAP message. The
incoming message is formed well and its length is 642 bytes ( I have
appended it to the end of this message).
I suspect that the reason may have something to do with an incorrect
declaration of which class to de-serialize to.
In the attached code I substituted @@@@@@@ in the code below with...
|
by: Anders Jansson |
last post by:
Hi all.
I have 2 problems when I try to open and convert an ASP.NET VS 2003
web-applikation in VS 2005.
In VS 2003 I have no problems at all!
First: One subfolder with will not be converted! The converted web project
are missing this subfolder completely.
39 errors are displayed in the Conversion Report saying: ERROR: Unable to
get local copy of file <file>. Why? All files are there and readable!!
|
by: Java Guy |
last post by:
I'm trying to view a web page. IE tells me there are (Java?) errors
on the page. Here they are:
Line: 15
Char: 7
Error: Wrong number of arguments or invalid propert assignment
Code: 0
URL: http://(address.of.my.webcam):port/LiveView.html
and
|
by: samarthkumar84 |
last post by:
Hi
I had used following code for sending e-mail but facing this problem.
I want to send this e-mail in ASP.NET using VB.NET code. I am
attaching both code an output.
CODE
Imports System.Web.HttpCookie
Imports System.Web.Mail
Imports System.Web.Mail.SmtpMail
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |