โปรแกรมบัญชีเกณพ์คงค้าง รพ.สต. สสจ.สุรินทร์ รายงานผู้บริหารด้านการเงิน รพ.สต.

String กับการ เขียน Query .net SQL Server


DateTime : 2011-01-31 15:20:02
Post By : huwko
IP Address : 118.175.76.231

clsVariables.conn =

New SqlConnection(clsVariables.strConn)Try

sb =

sb.Append(

sb.Append(

sb.Append(

sb.Append(

sb.Append(

sb.Append(

sb.Append(

sb.Append(

sb.Append(

sb.Append(

sb.Append(

sb.Append(

sb.Append(

sb.Append(

sb.Append(

 

 

.CommandText = sqlEdit

.CommandType = CommandType.Text

.Connection = clsVariables.conn

.Transaction = tr

.Parameters.Clear()

.Parameters.Add(

.Parameters.Add(

.Parameters.Add(

.Parameters.Add(

.Parameters.Add(

.Parameters.Add(

.Parameters.Add(

.Parameters.Add(

.Parameters.Add(

.Parameters.Add(

.Parameters.Add(

.Parameters.Add(

.Parameters.Add(

.Parameters.Add(

tr.Commit()

MessageBox.Show(

 

New StringBuilder()"UPDATE ben_product")" SET product_id = @product_id,")" product_name_th = @product_name_th,")" product_name_en = @product_name_en,")" product_total = @product_total,")" unit_id = @unit_id,")" price_tun = @price_tun,")" price_sale = @price_sale,")" supplier_id = @supplier_id,")" datein = @datein,")" datemake = @datemake,")" dateexpire = @dateexpire,")" product_detail = @product_detail,")" userdo = @userdo")" WHERE (id=@id)")Dim sqlEdit As String = sb.ToString()With clsVariables.com"@product_id", SqlDbType.VarChar).Value = Me.txtProductid.Text.Trim()"@product_name_th", SqlDbType.VarChar).Value = Me.txtProduct_name_th.Text.Trim()"@product_name_en", SqlDbType.VarChar).Value = Me.txtProduct_name_en.Text.Trim()"@product_total", SqlDbType.Int).Value = Me.txtProduct_total.Text.Trim()"@unit_id", SqlDbType.VarChar).Value = CStr(Me.cboUnit.SelectedValue)"@price_tun", SqlDbType.VarChar).Value = Me.txtPrice_tun.Text.Trim()"@price_sale", SqlDbType.VarChar).Value = Me.txtPrice_Sale.Text.Trim()"@supplier_id", SqlDbType.VarChar).Value = CStr(Me.cboSupplier.SelectedValue)"@datein", SqlDbType.DateTime).Value = Me.dtpDatein.Value"@datemake", SqlDbType.DateTime).Value = Me.dtpDateMake.Value"@dateexpire", SqlDbType.DateTime).Value = Me.dtpDateExpire.Value"@product_detail", SqlDbType.VarChar).Value = Me.txtProduct_detail.Text.Trim()"@userdo", SqlDbType.VarChar).Value = clsVariables.strUserConnect"@id", SqlDbType.Int).Value = Int(Me.txtID.Text)" !!!", "", MessageBoxButtons.OK, MessageBoxIcon.Information)End With

 

tr.Rollback()

MessageBox.Show(

 

Catch ex As Exception" " & ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Information)End Try

clsVariables.conn.Dispose()

clsVariables.conn.Open()

tr = clsVariables.conn.BeginTransaction()

 


Message !!

หากต้องการตอบกระทู้ Webboard กรุณาเข้าใช้ระบบก่อนนะค่ะ..


กระทู้ตอบกลับ