aminvb
شنبه 28 آذر 1388, 16:46 عصر
سلام
دوستان کد Insert در دستور زیر
If Len(TextBox6.Text) > 0 Then
''Insert To DataBase(Img_name)START
Dim fs As New FileStream(TextBox6.Text, FileMode.OpenOrCreate, FileAccess.Read)
Dim MyData(fs.Length) As Byte
fs.Read(MyData, 0, CInt(fs.Length))
fs.Close()
SqlDataAdapter1.InsertCommand.Parameters(11).Value = MyData
''Insert To DataBase(Image)END
Else
Dim fs As New FileStream(Application.StartupPath + "\defa.bmp", FileMode.OpenOrCreate, FileAccess.Read)
Dim MyData(fs.Length) As Byte
fs.Read(MyData, 0, CInt(fs.Length))
fs.Close()
SqlDataAdapter1.InsertCommand.Parameters(11).Value = MyData
End If
چطوری میتونیم دستور Insert بالا رو مانند دستور Insert پایین بنویسیم ؟
con.Open()
strsql = "INSERT INTO TempFactor (id,name) VALUES (' " & U & " ','" & T2.Text & "','" & textbox2.text & " ')"
com = New SqlCommand(strsql, con)
com.ExecuteNonQuery()
con.Close()
دوستان کد Insert در دستور زیر
If Len(TextBox6.Text) > 0 Then
''Insert To DataBase(Img_name)START
Dim fs As New FileStream(TextBox6.Text, FileMode.OpenOrCreate, FileAccess.Read)
Dim MyData(fs.Length) As Byte
fs.Read(MyData, 0, CInt(fs.Length))
fs.Close()
SqlDataAdapter1.InsertCommand.Parameters(11).Value = MyData
''Insert To DataBase(Image)END
Else
Dim fs As New FileStream(Application.StartupPath + "\defa.bmp", FileMode.OpenOrCreate, FileAccess.Read)
Dim MyData(fs.Length) As Byte
fs.Read(MyData, 0, CInt(fs.Length))
fs.Close()
SqlDataAdapter1.InsertCommand.Parameters(11).Value = MyData
End If
چطوری میتونیم دستور Insert بالا رو مانند دستور Insert پایین بنویسیم ؟
con.Open()
strsql = "INSERT INTO TempFactor (id,name) VALUES (' " & U & " ','" & T2.Text & "','" & textbox2.text & " ')"
com = New SqlCommand(strsql, con)
com.ExecuteNonQuery()
con.Close()