mysql数据库查找指定字符串的位置并修改同一行某个数据
例如下面是表的结构编号姓名1***2***3***现在有两个数组姓名{a,b,c....}和编号{1,2,3....},怎么通过查找编号将姓名插入数据表...
例如下面是表的结构
编号 姓名
1 ***
2 ***
3 ***
现在有两个数组姓名{a,b,c....}和编号{1,2,3....},怎么通过查找编号将姓名插入数据表 展开
编号 姓名
1 ***
2 ***
3 ***
现在有两个数组姓名{a,b,c....}和编号{1,2,3....},怎么通过查找编号将姓名插入数据表 展开
1个回答
展开全部
Public Sub upname1(ByVal in_id As String)
Dim name1 As String = "a,b,c,d"
Dim name_s() As String = Split(name1, ",")
Dim in_name As String = name_s(in_id - 1)
Dim up_m As New OleDbCommand
up_m.Connection = ole_conn
up_m.CommandText = "insert into tb1 (id1,name1) values(@id1,@name1)"
up_m.Parameters.AddWithValue("@id1", in_id)
up_m.Parameters.AddWithValue("@name1", in_name)
Try
ole_conn.Open()
up_m.ExecuteNonQuery()
ole_conn.Close()
Catch ex As Exception
ole_conn.Close()
MessageBox.Show(ex.Message)
End Try
End Sub
Dim name1 As String = "a,b,c,d"
Dim name_s() As String = Split(name1, ",")
Dim in_name As String = name_s(in_id - 1)
Dim up_m As New OleDbCommand
up_m.Connection = ole_conn
up_m.CommandText = "insert into tb1 (id1,name1) values(@id1,@name1)"
up_m.Parameters.AddWithValue("@id1", in_id)
up_m.Parameters.AddWithValue("@name1", in_name)
Try
ole_conn.Open()
up_m.ExecuteNonQuery()
ole_conn.Close()
Catch ex As Exception
ole_conn.Close()
MessageBox.Show(ex.Message)
End Try
End Sub
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询