Solved

SQL exception - Visual Studio 2010 - 64 bit Windows 7

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
I have a large data set and a SSIS package. How can I load this file in multi threading?
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

895 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

18 Experts available now in Live!

Get 1:1 Help Now