执行此操作的正确方法是什么,因为当我尝试此代码(dtgServices.Item ...)时,它只在数据库中插入00.00
sqlCon.Open()
dt = New DataTable
da = New MySqlDataAdapter("INSERT INTO `custsrv`(`custName`, `mechFName`,`mechLName`, `jobSrv`, `jobPrice`) " &
" VALUES (@custName,@mechFName,@mechLName,@jobSrv,@jobPrice)", sqlCon)
da.SelectCommand.Parameters.AddWithValue("@custName", res_id.Text)
da.SelectCommand.Parameters.AddWithValue("@mechFName", txtMechFn.Text)
da.SelectCommand.Parameters.AddWithValue("@mechLName", txtMechLn.Text)
da.SelectCommand.Parameters.AddWithValue("@jobsrv", txtService.Text)
da.SelectCommand.Parameters.AddWithValue("@jobPrice", dtgServices.Item(2, i).Value)
da.Fill(dt)
我的Datagridview的结构就是这个
connect_DB()
dt = New DataTable
da = New MySqlDataAdapter("SELECT m.mechfirstname as 'First Name',m.mechLastName as 'Last Name', " &
"s.mechPosition as 'Position', j.jobPrice as 'Price' FROM mechanicprofile m " &
"JOIN mechanicdeployment s ON s.mechid=m.mechID JOIN jobprofile j ON j.jobName=s.mechPosition ", sqlCon)
da.Fill(dt)
disconnect_DB()
dtgServices.DataSource = dt`