Solved

SQL exception - Visual Studio 2010 - 64 bit Windows 7

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
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 …
Viewers will learn how the fundamental information of how to create a table.
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.

710 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