0
가 돌아 데이터베이스에 테이블이 문자열이나 이진 데이터는
- 는
어떻게 든
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim SQLCmd As New SqlCommand
SQLCmd.Connection = SQLCon
SQLCon.open()
''insert data to sql database row by row
Dim taskname, location, start, complete As String
For i As Integer = 0 To Me.DataGridView1.Rows.Count
taskname = Me.DataGridView1.Rows(i).Cells(0).ToString()
start = Me.DataGridView1.Rows(i).Cells(1).ToString()
complete = Me.DataGridView1.Rows(i).Cells(2).ToString()
location = Me.DataGridView1.Rows(i).Cells(3).ToString()
SQLCmd.CommandText = "insert into timeline (project_id , taskname , start , complete , location) values (@pid,@task,@start,@complete,@location)"
SQLCmd.Parameters.AddWithValue("@pid", TextBox1.Text)
SQLCmd.Parameters.AddWithValue("@task", taskname)
SQLCmd.Parameters.AddWithValue("@start", start)
SQLCmd.Parameters.AddWithValue("@complete", complete)
SQLCmd.Parameters.AddWithValue("@location", location)
SQLCmd.ExecuteNonQuery()
Next
SQLCon.Close()
End Sub
어때요. 모든 칼럼에 nvarchar (50)를 사용 했습니까? 왜 아직도 오류가 발생합니까? –
당신은 내게 어떤 데이터 형인지 알려주시겠습니까? 쿼리로 전달할 값은 무엇입니까 –
http://goo.gl/5J8vzb –