Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SQL exception - Visual Studio 2010 - 64 bit Windows 7

Posted on 2010-08-29
4
Medium Priority
?
539 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 750 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 750 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how the fundamental information of how to create a table.

772 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