Hi,
You must create the parameter before setting its value, declaring the
parameter in the SQL query doesn't make it available in the Parameters
collection.
In C# this is somthing like this (I'm not familiar with VB.net) :
SqlParameter param=new SqlParameter("@FileName",SqlDbType.String);
Param.Value = sFileName;
MySqlCommand1.Parameters.Add(param);
MySqlCommand1.ExecuteNonQuery();
Hope this will help you.
Kant
Le 7/08/05 13:07, dans
A1**********************************@microsoft.com,
«*Niggy*» <Ni***@discussions.microsoft.com> a écrit*:
When setting parameters, I get the error:
System.IndexOutOfRangeException: Invalid index -1
With Me.MySqlCommand1
.Parameters("@FileName").Value = sFileName
.ExecuteNonQuery()
End With
The insert statement is:
INSERT INTO management (FileName) VALUES (@FileName)
Any ideas what's gone wrong?