Arun Anand
Arun Anand

Reputation: 335

sdf database connection error in windows installer

I am working on a windows form application in Visual studio 2010 using sdf database .I have created a setup file using the Setup Project in Visual Studio installer.

My problem is that when I install the application and try to log in using my log in page, There is an error occurring saying there is no row at position 0. I think the application is not connected to database.

Is there any difference in setup project when we use sdf database? Please help me with this.

enter image description here

Upvotes: 1

Views: 157

Answers (1)

It means that no results were returned from your query. You always have to code defensively and check to see if the Rows array has any items in it before trying to index into it. Something like:

if (dt.Rows.Length > 0)
   DoSomething();
else
    somethingWentWrong();

Upvotes: 0

Related Questions