Bonjour,

Mon problème est surement très simple pour la plupart d'entre vous mais je débute un peu...
Dans un formulaire de ma page web, j'ai placé un script C# (sans classe ni méthode.. juste ligne de code) qui va récupérer des données dans ma base de donnée pour les affichier dans un SELECT -> Ca marche très bien jusque la.
Ensuite, en même temps, j'aimerai effectué un appel de méthode que je place dans le même script.

Voila mon erreur
CS1519: Invalid token '(' in class, struct, or interface member declaration
Line 144: objConn.Open();
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
31
32
33
34
35
36
37
38
39
40
41
<%
	

	private void copyDirectory(string Src,string Dst){
		String[] Files;
		...
	}


	// initialize the connection string
	string strConnection = "...";
			
	// instantiate an instance of the OdbcConnection object
	OdbcConnection objConn = new OdbcConnection(strConnection);
    
	// create an instance of the OdbcCommand object
	OdbcCommand objCommand = new OdbcCommand("SELECT DISTINCT study FROM state WHERE cur_state=1", objConn);
    
	// open a database connection
	objConn.Open();
			
	// initialize the OdbcDataReader object
	OdbcDataReader objRdr = objCommand.ExecuteReader();
			
	Response.Write("<SELECT name=study size=1 onChange=\"mydesstudy(this.form.study.value)\" onClick=\"mydesstudy(this.form.study.value)\">");
				
	// copy the PGM folder and display the study ready to be loaded
	while(objRdr.Read()){
		Response.Write("<OPTION value="+objRdr.GetValue(0)+">"+objRdr.GetValue(0)+"</OPTION>");
		if (Convert.ToInt32(objRdr.GetValue(4)) == 0){
			string src = "F:\\SleepEEGApp\\electrophysio\\EEG_rat\\Program\\";
			string dst = "F:\\SleepEEGApp\\electrophysio\\EEG_rat\\Study\\"+objRdr.GetValue(0)+"\\program\\";
			copyDirectory(@src,@dst);
		}
	}
	Response.Write("</SELECT>");
	// free up memory
	objRdr.Close();
	objConn.Close();

%>
J'ai chercher mais je n'arrive pas à trouver la bonne syntaxe à utiliser...

Grand merci