Solved

SQL exception - Visual Studio 2010 - 64 bit Windows 7

Posted on 2010-08-29
4
534 Views
Last Modified: 2012-05-10
This windows app I just wrote on another computer and copied it to a nearly identical system throws both of these exceptiions on the same line of code -

A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll

And

Invalid column name 'WvArtist1'.

Here is a code snippet with the line marked which throws the exception -

Dim objConnection3 As New SqlConnection("Data Source=localhost\SQLEXPRESS;Initial Catalog=sql_song1;User ID=sa;Password=xxxxxxxx")
            Dim objDataAdapter3 As New SqlDataAdapter
            Dim objDataSet3 As New DataSet

            objDataAdapter3.SelectCommand = New SqlCommand()
            objDataAdapter3.SelectCommand.Connection = objConnection3
            objDataAdapter3.SelectCommand.CommandText = "SELECT * FROM tblWave1 WHERE tblWave1.WvArtist1 LIKE '%" & SearchStr3 & "%' "
            objConnection3.Open()

            'Fill the dataset object with data
            'objDataAdapter3.Fill(objDataSet3, "WaveFile")
            objDataAdapter3.Fill(objDataSet3, "D3")  <<----------here

Note in an earlier part of the Windows App an Open and Select statement to the same Sql database works fine.  I'm stubbed as to why.

Thanks in advance - Marvin E Marshall

The second exception I know definatively is not wrong.  I think the fresh copy of SqlExpress that I downloaded was set up the same.  
0
Comment
Question by:MarvinEMarshall
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
pbarry1 earned 250 total points
ID: 33553603
Hi,

here's a couple of things to check:

1) You seem to prefix your SQL objects.  By any chance, wouldn't it just be that the column name is really vWArtist1 instead of WvArtist1?

2) Is your database case-sensitive?  Maybe the "case" of the column name is incorrect?
0
 
LVL 8

Assisted Solution

by:Mohit Vijay
Mohit Vijay earned 250 total points
ID: 33553765
because you are using localhost database, so it might be possible that your other computer has different type of structure of database tables.

Check tblWave1 structure on both computers and see if WvArtist1 belong to both database tables.
0
 

Author Comment

by:MarvinEMarshall
ID: 33608227
pbarry1 and VjSoft
Sorry I haven't responded promptly.  I seems both my developement computer and production computer went south within hours of each other.  So, until I rebuilt on computer and bought a new one, I was totally down.  When I Restored a backup of the errent tblWave with the column name of WvArtist it worked fine on the new computer.  So, possibly I was a victum of a virus that somehow got past my protection.  So, both of your suggestions would have been something to check for, the problem was deeper than the SQL table.  Thanks for the help however.
Marvin E Marshall
0
 

Author Closing Comment

by:MarvinEMarshall
ID: 33608299
Actual solution was solved by the purchase of a new computer.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question