Solved

SQL exception - Visual Studio 2010 - 64 bit Windows 7

Posted on 2010-08-29
4
527 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
  • 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how the fundamental information of how to create a table.

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now