Hi,
Here is my question,
I have created a table TERMES which contains two fields : ID_TERME(the identifier of each term) Lib_TERME(contains the label of each term).
I want to permit a user to type a same term in a treview at two different places in the treeview.
It means this term( the user can reuse) has one term above at one place of the treeview and has another term above at another place in the treeview.
The relation generic(terme which is above in the treeview)/specific(terme under the generic in the treeview)is in the Table GENERIQUES.
The field ID_TERME_SOURCE_G contains all the specific terms(child) and the field ID_TERME_GENERIQUE contains the generic terms(parent).
For example if we have
ID_TERME_SOURCE_G ID_TERME_GENERIQUE
2 8
it means that in the treeview we have this
8
2
8 and 2 are the tag of each term.
So now, if the user says he wants to reuse the term which tag is 2 and to put it under the term which tag is 10
he wants to see this in the treeview
8
2
10
2
Now i want to translate this in the code.
strLibelle is a new inputbox.
termexists is a boolean which indicates if the term already exists in the db.
Here is what is the present code i have written :
But i receive an error at this level " & CType(drTerme.Item("ID_TERME"), Integer) & "
Could you explain to me why and help me to correct this sql request to obtain an exact one.
Thanks a lot for all your help.
Best regards.
Nathalie
Here is my question,
I have created a table TERMES which contains two fields : ID_TERME(the identifier of each term) Lib_TERME(contains the label of each term).
I want to permit a user to type a same term in a treview at two different places in the treeview.
It means this term( the user can reuse) has one term above at one place of the treeview and has another term above at another place in the treeview.
The relation generic(terme which is above in the treeview)/specific(terme under the generic in the treeview)is in the Table GENERIQUES.
The field ID_TERME_SOURCE_G contains all the specific terms(child) and the field ID_TERME_GENERIQUE contains the generic terms(parent).
For example if we have
ID_TERME_SOURCE_G ID_TERME_GENERIQUE
2 8
it means that in the treeview we have this
8
2
8 and 2 are the tag of each term.
So now, if the user says he wants to reuse the term which tag is 2 and to put it under the term which tag is 10
he wants to see this in the treeview
8
2
10
2
Now i want to translate this in the code.
strLibelle is a new inputbox.
termexists is a boolean which indicates if the term already exists in the db.
Here is what is the present code i have written :
Code:
termexists = False
For Each drTerme In objDS.Tables("TERMES").Rows
If strLibelle.ToLower = CType(drTerme.Item("Lib_TERME"), String) Then
termeexiste = True
If MessageBox.Show("this term is already in the database, do you want to reuse it?", "addition of a new term", MessageBoxButtons.YesNoCancel) = DialogResult.Yes Then
strSQLInsertGeneriqueTermerepete = "INSERT into GENERIQUES (ID_TERME_SOURCE_G, ID_TERME_GENERIQUE) values ( " & CType(drTerme.Item("ID_TERME"), Integer) & " , " & strTag.Substring(2).ToString & ")"
objConn.Open()
objinsertgeneriquetermerepete = New SqlCommand(strSQLInsertGeneriqueTermerepete, objConn)
objinsertgeneriquetermerepete.ExecuteNonQuery()
objConn.Close()
But i receive an error at this level " & CType(drTerme.Item("ID_TERME"), Integer) & "
Could you explain to me why and help me to correct this sql request to obtain an exact one.
Thanks a lot for all your help.
Best regards.
Nathalie