Click here to Skip to main content
15,891,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
private static int GetMovieID(string MovieName)
		{

			int MovieID = 0;
			OleDbCommand com = new OleDbCommand("SELECT * FROM movies                        WHERE [movieName]='" + MovieName + "'",cn);
			OleDbDataReader dr = com.ExecuteReader();
			while (dr.Read())
			{
				MovieID = (int)dr["ID"];
			}
			return MovieID;
            
		}


[edit]added code block[/edit]
Posted
Updated 11-Nov-12 4:34am
v2

1 solution

The answer is in the error message.

Where do you think this goes:
cn.Open();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900