Public variable

Hi Guys

Can someone tell me how I can create a variable in c++ cli for example the following will not work

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
		//I want this to be used by all the following voids
		String^ cn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='C:/Documents and Settings/shamals/Desktop/VS.NET/C++/GMI/GMI_be.mdb'";

		private : void Confirmations(String^ table){
			
				
				OleDb::OleDbConnection^ con = gcnew OleDb::OleDbConnection(cn);
				OleDb::OleDbCommand^ cmd = gcnew OleDb::OleDbCommand;
				con->Open();
				
				cmd->CommandType = CommandType::TableDirect;
				cmd->CommandText = table;
				cmd->Connection = con;
			//etc
		}

		private : void Purchases(){
		
				OleDb::OleDbConnection^ con = gcnew OleDb::OleDbConnection(cn)
				OleDb::OleDbCommand^ cmd = gcnew OleDb::OleDbCommand;
				con->Open();
				
				cmd->CommandType = CommandType::TableDirect;
				cmd->CommandText = table;
				cmd->Connection = con;
			//etc			

		}



I I need the variable to have a public scope.

Thanks
Last edited on
Topic archived. No new replies allowed.