ExecuteNonQuery returns 1 , Database wont Update
hello i am creating a Windows Application
C# 3.5
when i executeing function to insert into SQL Epxress
it returns 1 on the Rows Effect but checking the Database Data nothing is inserted.
public int ExectueNonQuery(string command)
{
int Results = -1;
try
{
connection = new SqlConnection(ConnectionString);
connection.Open();
scommand = new SqlCommand(command, connection);
Results = scommand.ExecuteNonQuery();
}
finally
{
scommand.Dispose();
if (connection != null)
connection.Close();
}
return Results;
}

Itzik S9 reputationPosted Jun 11, 2009, 2:26 PM EDT
Cory7 reputationPosted Jun 23, 2009, 7:27 AM EDT
You said the problem was with your "DB Location"; could you please elaborate? What exactly was the problem with your DB location? Did you need to alter the connection string, or a database property, or anything else?
In short, what problem did you find with your DB Location, and how did you correct the issue? Thanks!
Itzik S9 reputationPosted Jun 23, 2009, 7:38 AM EDT
Cory7 reputationPosted Jun 23, 2009, 9:29 AM EDT
So, I have stored my database at C:\Test\ProjectInfo.mdf -- what other steps will I need to take?
Would my connection string simply be the file path? Do I have to add that localized database (Project --> Add Existing Item...) into my project from within visual studio? I have tried a few different things and keep getting an error when I attempt to open a connection to that localized database.
Itzik S9 reputationPosted Jun 23, 2009, 9:43 AM EDT
Cory7 reputationPosted Jun 23, 2009, 10:00 AM EDT
Itzik S9 reputationPosted Jun 23, 2009, 10:45 AM EDT