Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this is my code, it is run before but now cannot
VB
Try
    conn.Open()
    Dim Query As String
    Query = " Select * from ebplsgabaldon.applicationtable"
    COMMAND = New MySqlCommand(Query, conn)
    SDA.SelectCommand = COMMAND  'this is the error COMMAND'
    SDA.Fill(dbDataset)
    bSource.DataSource = dbDataset
    DataGridView1.DataSource = bSource
    SDA.Update(dbDataset)
    TxtRowCount.Text = DataGridView1.RowCount - 1
    DataGridView1.Sort(DataGridView1.Columns(5), System.ComponentModel.ListSortDirection.Ascending)
    conn.Close()
Catch ex As Exception
    MessageBox.Show(ex.Message)
Finally
    conn.Dispose()
End Try


What I have tried:

i tried to reinstall visual baic 2010 but still error
Posted
Updated 29-Mar-16 22:26pm
v2

1 solution

Apparently the MySqlCommand that you create there is a custom type in your solution and not the "real" MySqlCommand, which is why you can't assign it to the .SelectCommand-property of the DataAdapter.

The first question I would try to solve is why there is a custom class MySqlCommand (under the namespace "lgugabaldon") in your solution. What is its purpose and should it actually be used somehow for this task? (It's very uncommon to have a class with such a name in a custom namespace!)

Maybe you can ignore it and just use the real MySqlCommand by either removing the using-directive for the lgugabaldon-namespace or by prefixing MySqlCommand with the namespace (MySql.Data.MySqlClient.MySqlCommand), which you would have to do for the declaration of COMMAND and for the new-expression.

Maybe you should even remove the MySqlCommand class in the lgugabaldon-namespace but I can't say for sure because I don't know why it's there in the first place.
 
Share this answer
 
v2
Comments
Member 12425127 30-Mar-16 21:13pm    
i will remove the COMMAND
THIS IS NEW ERROR

Error 12 Unable to copy file "obj\x86\Debug\lgugabaldon.exe" to "bin\Debug\lgugabaldon.exe". The process cannot access the file 'bin\Debug\lgugabaldon.exe' because it is being used by another process. lgugabaldon

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