how to creat a database in binary format
i have to create a sql database in binary format is it possible to create and transaction on binary database if yes then please give me wright the suggestion this is my contact no 09273172515 if any buddy wants a extra information thank you
hitesh bansalPosted Apr 27, 2009, 2:26 AM
Public
Class cateloges Dim serialno As Integer Dim updatebt As Boolean = False Dim total As Double = 0.0 Dim img As String = "" Private Sub btref_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btref.Click ' On Error GoTo errorhandler Dim photo As StringPictureBox1.BackgroundImage = PictureBox2.BackgroundImage
txtcode.Text =
""img = Getapp() &
"\inspireimage\noimg.jpg" Exit Suberrorhandler:
MsgBox(
"ERROR:-" & Microsoft.VisualBasic.vbCrLf & Err.Description)disconnect()
End Sub Private Sub btbrow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btbrow.Click ' On Error GoTo errorhandlerPictureBox1.BackgroundImage = PictureBox2.BackgroundImage
OpenFileDialog1.ShowDialog()
If OpenFileDialog1.FileName <> "OpenFileDialog1" Then If updatebt = False Then Call setimgpath(CStr(OpenFileDialog1.FileName), "2") Else Call setimgpath(CStr(OpenFileDialog1.FileName), "3") End If Call disconnect() Call connect()cmd.Connection = con
cmd.CommandText =
"delete from temp"cmd.ExecuteNonQuery()
Dim ms1 As FileStream = New FileStream(OpenFileDialog1.FileName, FileMode.Open) Dim arr As Byte() = New Byte(ms1.Length) {}ms1.Read(arr, 0, ms1.Length)
ms1.Close()
cmd.CommandText =
"" Dim str As String = "INSERT INTO temp(tempimg) VALUES(@temp)" Dim cmd11 As New SqlClient.SqlCommand(str, con) Dim temp As SqlParameter = New SqlParameter("@temp", SqlDbType.Image)temp.Value = arr
cmd11.Parameters.Add(temp)
' titlecmd11.ExecuteNonQuery()
'copyimg()img = OpenFileDialog1.FileName
Dim str1 As String = "select tempimg from temp" Dim cmd12 As New SqlClient.SqlCommand(str, con) Call connect() Dim arr1 As Byte() = CType(cmd11.ExecuteScalar, Byte()) Dim ms2 As MemoryStream = New MemoryStream(arr)PictureBox1.BackgroundImageLayout = ImageLayout.Stretch
PictureBox1.BackgroundImage = Image.FromStream(ms2)
Elseimg = Getapp() &
"\inspireimage\noimg.jpg" End If Exit Suberrorhandler:
MsgBox(
"ERROR:-" & Microsoft.VisualBasic.vbCrLf & Err.Description)disconnect()
End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Me.Close() End Sub Private Sub cateloges_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosingclosemaster()
End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btclose.Click Me.Close() End Sub 'Private Sub caltotal() ' Dim i As Integer = 0 ' txttotalpc.Text = 0 ' For i = 0 To DataGridView1.Rows.Count - 1 ' txttotalpc.Text = Val(txtpc.Text) + Val(DataGridView1.Rows(i).Cells(4).Value) ' Next 'End Sub Private Sub btedit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btedit.Click ' On Error GoTo errorhandlerbtnew.Visible =
Truebtedit.Visible =
Falsetxtcode.Visible =
Falsecbcode.Visible =
Trueupdatebt =
True Call fillcatlog() Exit Sub '------------------------------error handling----------------------------errorhandler:
MsgBox(
"ERROR:-" & Microsoft.VisualBasic.vbCrLf & Err.Description) End Sub Private Sub btnew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnew.Click ' On Error GoTo errorhandlerbtnew.Visible =
Falsebtedit.Visible =
Truetxtcode.Visible =
Truecbcode.Visible =
Falseupdatebt =
False Call fillcatlog() Exit Sub '------------------------------error handling----------------------------errorhandler:
MsgBox(
"ERROR:-" & Microsoft.VisualBasic.vbCrLf & Err.Description) End Sub Private Sub cateloges_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Call checkmatel() Call fillcatlog() Call fillcombo()rbtgold.Checked =
True End Sub Private Sub fillcatlog() 'On Error GoTo errorhandlertxtgwt.Text =
""txtngwt.Text =
"0"txtnswt.Text =
"0"txtstogross.Text =
""DataGridView1.Rows.Clear()
txtpc.Text =
""txtwt.Text =
""img = Getapp() &
"\inspireimage\noimg.jpg"PictureBox1.BackgroundImage = PictureBox2.BackgroundImage
Call disconnect() Exit Sub '------------------------------error handling----------------------------errorhandler:
MsgBox(
"ERROR:-" & Microsoft.VisualBasic.vbCrLf & Err.Description) End Sub Private Sub fillcombo() ' On Error GoTo errorhandler Call connect()cmd.Connection = con
cmd.CommandText =
"select purity_id,purity_code from puritymaster order by purity_id"dr = cmd.ExecuteReader
cbpuid.Items.Clear()
cbpucode.Items.Clear()
While dr.Read = Truecbpuid.Items.Add(dr.Item(0))
cbpucode.Items.Add(dr.Item(1))
cbpuid.SelectedIndex = 0
cbpucode.SelectedIndex = 0
End Whiledr.Close()
cmd.CommandText =
"select stonename_id, stonename_name from stonenamemaster order by stonename_id"dr = cmd.ExecuteReader
cbstnameid.Items.Clear()
cbstoname.Items.Clear()
While dr.Read = Truecbstnameid.Items.Add(dr.Item(0))
cbstoname.Items.Add(dr.Item(1))
cbstnameid.SelectedIndex = 0
cbstoname.SelectedIndex = 0
End Whiledr.Close()
cmd.CommandText =
"select stoneshape_id, stoneshape_name from stoneshapesizemaster order by stoneshape_id "dr = cmd.ExecuteReader
cbstshapeid.Items.Clear()
cbstoshape.Items.Clear()
While dr.Read = Truecbstshapeid.Items.Add(dr.Item(0))
cbstoshape.Items.Add(dr.Item(1))
cbstshapeid.SelectedIndex = 0
cbstoshape.SelectedIndex = 0
End Whiledr.Close()
cmd.CommandText =
"select * from catalogtype order by cata_type asc"dr = cmd.ExecuteReader
cbdtype.Items.Clear()
While dr.Read = Truecbdtype.Items.Add(dr.Item(1))
cbdtype.SelectedIndex = 0
End Whiledr.Close()
Exit Sub '------------------------------error handling----------------------------errorhandler:
MsgBox(
"ERROR:-" & Microsoft.VisualBasic.vbCrLf & Err.Description) End Sub Private Sub cbstoname_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbstoname.SelectedIndexChanged ' On Error GoTo errorhandlercbstnameid.SelectedIndex = cbstoname.SelectedIndex
Call connect()txtstocolor.Text =
""cmd1.Connection = con
cmd1.CommandText =
"select * from stonenamemaster where stonename_id=" & Val(cbstnameid.Text)dr1 = cmd1.ExecuteReader
If dr1.Read = True Then If IsDBNull(dr1.Item(2)) = False Thentxtstocolor.Text = dr1.Item(2)
End If End Ifdr1.Close()
Exit Sub '------------------------------error handling----------------------------errorhandler:
MsgBox(
"ERROR:-" & Microsoft.VisualBasic.vbCrLf & Err.Description) End Sub Private Sub calgstone() On Error GoTo errorhandler Dim i As Integertxtstogross.Text = 0
txttotalpc.Text = 0
For i = 0 To DataGridView1.Rows.Count - 1txttotalpc.Text = txttotalpc.Text + Val(DataGridView1.Rows(i).Cells(4).Value)
txtstogross.Text = txtstogross.Text + Val(DataGridView1.Rows(i).Cells(5).Value)
Next Exit Sub '------------------------------error handling----------------------------errorhandler:
MsgBox(
"ERROR:-" & Microsoft.VisualBasic.vbCrLf & Err.Description) End Sub Private Sub btadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btadd.Click On Error GoTo errorhandler If txtpc.Text <> "" And txtwt.Text <> "" ThenDataGridView1.Rows.Add(cbstoname.Text, txtstocolor.Text, cbstoshape.Text, txtsize.Text, txtpc.Text, txtwt.Text)
Call calgstone()cbstoname.SelectedIndex = 0
cbstoshape.SelectedIndex = 0
txtpc.Text =
""txtwt.Text =
"" ElseMsgBox(
"Please Enter PC Value and Wt") End Iftxtgwt.Text = Val(txtngwt.Text) + Val(txtnswt.Text) + (Val(txtstogross.Text) / 5)
Exit Sub '------------------------------error handling----------------------------errorhandler:
MsgBox(
"ERROR:-" & Microsoft.VisualBasic.vbCrLf & Err.Description) ' Call caltotal() End Sub Private Sub btsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btsave.Click On Error GoTo errorhandler Call connect() 'Call caltotal() Dim i As Integer Dim mgn As String = "" Dim mgn1 As Double Call calgstone() If updatebt = False Thencmd1.Connection = con
If txtcode.Text = "" ThenMsgBox(
"Design Code Should not be blank") Exit Sub End If
Dim ms1 As FileStream = New FileStream(img, FileMode.Open) Dim arr As Byte() = New Byte(ms1.Length) {}ms1.Read(arr, 0, ms1.Length)
ms1.Close()
cmd.CommandText =
"" Dim str As String = "INSERT INTO catalogmaster(cat_design_id,cat_img,purity_id,cat_itemgrosswt,cat_netgoldwt,cat_netsilverwt,cat_stonewt,cat_type,cat_totalpc) VALUES(@srno,@pic,@pid,@cat_itgross,@goldwt,@silverwt,@cat_swt,@catype,@totalpc)" Dim cmd11 As New SqlClient.SqlCommand(str, con) Dim srno As SqlParameter = New SqlParameter("@srno", SqlDbType.NVarChar, 50)srno.Value = txtcode.Text
cmd11.Parameters.Add(srno)
Dim catype As SqlParameter = New SqlParameter("@catype", SqlDbType.NVarChar, 50)catype.Value = cbdtype.Text
cmd11.Parameters.Add(catype)
Dim pid As SqlParameter = New SqlParameter("@pid", SqlDbType.Int)pid.Value = Val(cbpuid.Text)
cmd11.Parameters.Add(pid)
Dim cat_itgross As SqlParameter = New SqlParameter("@cat_itgross", SqlDbType.Float)cat_itgross.Value = Val(txtgwt.Text)
cmd11.Parameters.Add(cat_itgross)
Dim goldwt As SqlParameter = New SqlParameter("@goldwt", SqlDbType.Float)goldwt.Value = Val(txtngwt.Text)
cmd11.Parameters.Add(goldwt)
Dim silverwt As SqlParameter = New SqlParameter("@silverwt", SqlDbType.Float)silverwt.Value = Val(txtnswt.Text)
cmd11.Parameters.Add(silverwt)
Dim cat_swt As SqlParameter = New SqlParameter("@cat_swt", SqlDbType.Float)cat_swt.Value = Val(txtstogross.Text)
cmd11.Parameters.Add(cat_swt)
Dim pic As SqlParameter = New SqlParameter("@pic", SqlDbType.Image)pic.Value = arr
cmd11.Parameters.Add(pic)
Dim totalpc As SqlParameter = New SqlParameter("@totalpc", SqlDbType.NVarChar, 50)totalpc.Value = Val(txttotalpc.Text)
cmd11.Parameters.Add(totalpc)
cmd11.ExecuteNonQuery()
cmd1.Connection = con
cmd1.CommandText =
"Select cat_id from catalogmaster where cat_design_id='" & txtcode.Text & "'"dr = cmd1.ExecuteReader
If dr.Read = True Then Dim catid As Integercatid = dr.Item(0)
dr.Close()
For i = 0 To DataGridView1.Rows.Count - 1cmd1.Connection = con
cmd1.CommandText =
"insert into catalogstonedetail values(" & catid & ",'" & DataGridView1.Rows(i).Cells(0).Value & "','" & DataGridView1.Rows(i).Cells(1).Value & "','" & DataGridView1.Rows(i).Cells(2).Value & "','" & DataGridView1.Rows(i).Cells(3).Value & "'," & Val(DataGridView1.Rows(i).Cells(4).Value) & "," & Val(DataGridView1.Rows(i).Cells(5).Value) & ")"cmd1.ExecuteNonQuery()
Next End If Elsecmd1.Connection = con
If cbcode.Text = "" ThenMsgBox(
"Design Code Should not be blank") Exit Sub End Ifcmd1.CommandText =
"delete from catalogstonedetail where cat_id=" & Val(cbcatid.Text)cmd1.ExecuteNonQuery()
For i = 0 To DataGridView1.Rows.Count - 1cmd1.Connection = con
cmd1.CommandText =
"insert into catalogstonedetail values(" & cbcatid.Text & ",'" & DataGridView1.Rows(i).Cells(0).Value & "','" & DataGridView1.Rows(i).Cells(1).Value & "','" & DataGridView1.Rows(i).Cells(2).Value & "','" & DataGridView1.Rows(i).Cells(3).Value & "'," & Val(DataGridView1.Rows(i).Cells(4).Value) & "," & Val(DataGridView1.Rows(i).Cells(5).Value) & ")"cmd1.ExecuteNonQuery()
Nextcmd.CommandText =
"" Dim str As String = "Update catalogmaster set cat_design_id=@srno,purity_id=@pid,cat_itemgrosswt=@cat_itgross,cat_netgoldwt=@goldwt,cat_netsilverwt=@silverwt,cat_stonewt=@cat_swt,cat_type=@catype,cat_totalpc=@totalpc where cat_id = " & Val(cbcatid.Text) Dim cmd11 As New SqlClient.SqlCommand(str, con) Dim srno As SqlParameter = New SqlParameter("@srno", SqlDbType.NVarChar, 50)srno.Value = txtcode.Text
cmd11.Parameters.Add(srno)
Dim pid As SqlParameter = New SqlParameter("@pid", SqlDbType.Int)pid.Value = Val(cbpuid.Text)
cmd11.Parameters.Add(pid)
Dim cat_itgross As SqlParameter = New SqlParameter("@cat_itgross", SqlDbType.Float)cat_itgross.Value = Val(txtgwt.Text)
cmd11.Parameters.Add(cat_itgross)
Dim catype As SqlParameter = New SqlParameter("@catype", SqlDbType.NVarChar, 50)catype.Value = cbdtype.Text
cmd11.Parameters.Add(catype)
Dim goldwt As SqlParameter = New SqlParameter("@goldwt", SqlDbType.Float)goldwt.Value = Val(txtngwt.Text)
cmd11.Parameters.Add(goldwt)
Dim silverwt As SqlParameter = New SqlParameter("@silverwt", SqlDbType.Float)silverwt.Value = Val(txtnswt.Text)
cmd11.Parameters.Add(silverwt)
Dim cat_swt As SqlParameter = New SqlParameter("@cat_swt", SqlDbType.Float)cat_swt.Value = Val(txtstogross.Text)
cmd11.Parameters.Add(cat_swt)
Dim totalpc As SqlParameter = New SqlParameter("@totalpc", SqlDbType.NVarChar, 50)totalpc.Value = txttotalpc.Text
cmd11.Parameters.Add(totalpc)
'Dim path As String 'path = Getapp() & "\inspireimage\noimg.jpg" If img <> "" Then Dim str1 As String = "update catalogmaster set cat_img=@pic where cat_id=" & Val(cbcatid.Text) Dim cmd12 As New SqlClient.SqlCommand(str1, con) Dim ms1 As FileStream = New FileStream(img, FileMode.Open) Dim arr As Byte() = New Byte(ms1.Length) {}ms1.Read(arr, 0, ms1.Length)
ms1.Close()
Dim pic As SqlParameter = New SqlParameter("@pic", SqlDbType.Image)pic.Value = arr
cmd12.Parameters.Add(pic)
cmd12.ExecuteNonQuery()
End If 'cmd1.Connection = con 'cmd1.CommandText = "Select cat_id from catalogmaster where cat_design_id='" & txtcode.Text & "'" 'dr = cmd1.ExecuteReader 'If dr.Read = True Then ' Dim catid As Integer ' catid = dr.Item(0) ' dr.Close() ' For i = 0 To DataGridView1.Rows.Count - 1 ' cmd1.Connection = con ' cmd1.CommandText = "insert into catalogstonedetail values(" & catid & ",'" & DataGridView1.Rows(i).Cells(0).Value & "','" & DataGridView1.Rows(i).Cells(1).Value & "','" & DataGridView1.Rows(i).Cells(2).Value & "'," & Val(DataGridView1.Rows(i).Cells(3).Value) & "," & Val(DataGridView1.Rows(i).Cells(4).Value) & ")" ' cmd1.ExecuteNonQuery() ' Next 'End If End IfMsgBox(
"Information Save") Call fillcatlog() Dim k As Integer = 0k = cbdtype.SelectedIndex
cbdtype.SelectedIndex = 0
cbdtype.SelectedIndex = k
Call disconnect() Exit Sub '------------------------------error handling----------------------------errorhandler:
MsgBox(
"ERROR:-" & Microsoft.VisualBasic.vbCrLf & Err.Description) End Sub Private Sub cbcatid_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbcatid.SelectedIndexChangedcbcode.SelectedIndex = cbcatid.SelectedIndex
End Sub Private Sub cbcode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbcode.SelectedIndexChanged On Error GoTo errorhandlercbcatid.SelectedIndex = cbcode.SelectedIndex
txtgwt.Text =
""txtngwt.Text =
""txtnswt.Text =
""txtstogross.Text =
""DataGridView1.Rows.Clear()
txtpc.Text =
""txtwt.Text =
"" If Val(cbcatid.Text) > 0 Then
Call connect()cmd2.Connection = con
cmd2.CommandText =
"select * from catalogmaster where cat_id=" & Val(cbcatid.Text)dr2 = cmd2.ExecuteReader
If dr2.Read = True Then If IsDBNull(dr2.Item(3)) = False Thencbpuid.SelectedItem = dr2.Item(3)
End If If IsDBNull(dr2.Item(4)) = False Thentxtgwt.Text = dr2.Item(4)
End If If IsDBNull(dr2.Item(5)) = False Thentxtngwt.Text = dr2.Item(5)
End If If IsDBNull(dr2.Item(6)) = False Thentxtnswt.Text = dr2.Item(6)
End If If IsDBNull(dr2.Item(7)) = False Thentxtstogross.Text = dr2.Item(7)
End If If IsDBNull(dr2.Item(9)) = False Thentxttotalpc.Text = dr2.Item(9)
End If End Ifdr2.Close()
cmd2.Connection = con
cmd2.CommandText =
"select * from catalogstonedetail where cat_id=" & Val(cbcatid.Text)dr2 = cmd2.ExecuteReader
While dr2.ReadDataGridView1.Rows.Add(dr2.Item(1), dr2.Item(2), dr2.Item(3), dr2.Item(4), dr2.Item(5), dr2.Item(6))
End Whiledr2.Close()
Dim str As String = "select cat_img from catalogmaster where cat_id=" & Val(cbcatid.Text) Dim cmd11 As New SqlClient.SqlCommand(str, con) Call connect() Dim arr As Byte() = CType(cmd11.ExecuteScalar, Byte()) Dim ms1 As MemoryStream = New MemoryStream(arr)PictureBox1.BackgroundImageLayout = ImageLayout.Stretch
PictureBox1.BackgroundImage = Image.FromStream(ms1)
img =
"" Exit Suberrorhandler:
If Err.Number = 53 ThenPictureBox1.BackgroundImage = PictureBox2.BackgroundImage
ElseMsgBox(
"ERROR:-" & Microsoft.VisualBasic.vbCrLf & Err.Description) End If ElsePictureBox1.BackgroundImage = PictureBox2.BackgroundImage
End If End Sub Private Sub cbstoshape_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbstoshape.SelectedIndexChanged ' On Error GoTo errorhandlercbstshapeid.SelectedIndex = cbstoshape.SelectedIndex
Call connect()txtsize.Text =
""cmd1.Connection = con
cmd1.CommandText =
"select * from stoneshapesizemaster where stoneshape_id=" & Val(cbstshapeid.Text)dr1 = cmd1.ExecuteReader
If dr1.Read = True Then If IsDBNull(dr1.Item(2)) = False Thentxtsize.Text = dr1.Item(2)
End If End Ifdr1.Close()
Exit Sub '------------------------------error handling----------------------------errorhandler:
MsgBox(
"ERROR:-" & Microsoft.VisualBasic.vbCrLf & Err.Description) End Sub Private Sub cbstshapeid_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbstshapeid.SelectedIndexChangedcbstoshape.SelectedIndex = cbstshapeid.SelectedIndex
End Sub Private Sub btfull_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btfull.Clickfrm_image.PictureBox1.BackgroundImage = PictureBox1.BackgroundImage
frm_image.ShowDialog()
End Sub
Private Sub cbpucode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbpucode.SelectedIndexChanged On Error GoTo errorhandler Call connect()cmd1.Connection = con
cmd1.CommandText =
"select * from puritymaster where purity_code='" & cbpucode.Text & "'"dr3 = cmd1.ExecuteReader
cbputype.Items.Clear()
cbpuid.Items.Clear()
While dr3.Readcbpuid.Items.Add(dr3.Item(0))
cbputype.Items.Add(dr3.Item(2))
cbputype.SelectedIndex = 0
cbpuid.SelectedIndex = 0
End Whiledr3.Close()
Exit Sub '--------- Error Handling---------errorhandler:
MsgBox(
"ERROR:-" & Microsoft.VisualBasic.vbCrLf & Err.Description) End Sub Private Sub cbputype_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbputype.SelectedIndexChangedcbpuid.SelectedIndex = cbputype.SelectedIndex
txtpuval.Text = cbputype.SelectedItem
On Error GoTo errorhandler Call connect()cmd1.Connection = con
cmd1.CommandText =
"select * from puritymaster where purity_id=" & Val(cbpuid.Text)dr1 = cmd1.ExecuteReader
If dr1.Read = True Then If IsDBNull(dr1.Item(3)) = False Thentxtpurremark.Text = dr1.Item(3)
End If End Ifdr1.Close()
Exit Sub '--------- Error Handling---------errorhandler:
MsgBox(
"ERROR:-" & Microsoft.VisualBasic.vbCrLf & Err.Description) End Sub Private Sub checkmatel() If rbtgold.Checked = True Thentxtnswt.Enabled =
Falsetxtngwt.Enabled =
True Call connect()cmd.Connection = con
cmd.CommandText =
"select * from puritytype where purity_matel='gold' order by purity_id asc"dr = cmd.ExecuteReader
cbpucode.Items.Clear()
While dr.Readcbpucode.Items.Add(dr(1))
cbpucode.SelectedIndex = 0
End Whiledr.Close()
Else If rbtsilver.Checked = True Thentxtngwt.Enabled =
Falsetxtnswt.Enabled =
True Call connect()cmd.Connection = con
cmd.CommandText =
"select * from puritytype where purity_matel='silver' order by purity_id asc"dr = cmd.ExecuteReader
cbpucode.Items.Clear()
While dr.Readcbpucode.Items.Add(dr(1))
cbpucode.SelectedIndex = 0
End Whiledr.Close()
End If End If End Sub Private Sub rbtgold_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtgold.CheckedChanged Call checkmatel() 'If rbtgold.Checked = True Then ' Call connect() ' cmd.Connection = con ' cmd.CommandText = "select * from puritytype where purity_matel='gold' order by purity_id asc" ' dr = cmd.ExecuteReader ' cbpucode.Items.Clear() ' While dr.Read ' cbpucode.Items.Add(dr(1)) ' cbpucode.SelectedIndex = 0 ' End While ' dr.Close() 'End If End Sub Private Sub rbtsilver_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtsilver.CheckedChanged Call checkmatel() 'If rbtsilver.Checked = True Then ' Call connect() ' cmd.Connection = con ' cmd.CommandText = "select * from puritytype where purity_matel='silver' order by purity_id asc" ' dr = cmd.ExecuteReader ' cbpucode.Items.Clear() ' While dr.Read ' cbpucode.Items.Add(dr(1)) ' cbpucode.SelectedIndex = 0 ' End While ' dr.Close() 'End If End Sub Private Sub cbdtype_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbdtype.SelectedIndexChanged Dim a As Integer = 1 Dim code As String = "" Call connect()cmd.Connection = con
cmd.CommandText =
"select cat_id,cat_design_id from catalogmaster where cat_type='" & cbdtype.Text & "'"dr4 = cmd.ExecuteReader
cbcode.Items.Clear()
cbcatid.Items.Clear()
cbcode.Items.Add(
"Select")cbcatid.Items.Add(
"Select") While dr4.Read = Truecbcode.Items.Add(dr4.Item(1))
cbcatid.Items.Add(dr4.Item(0))
a = a + 1
End Whilecbcode.SelectedIndex = 0
cbcatid.SelectedIndex = 0
code = cbdtype.Text &
"-" & adr4.Close()
txtcode.Text = code
txtgwt.Text =
""txtngwt.Text =
""txtnswt.Text =
""txtstogross.Text =
""DataGridView1.Rows.Clear()
txtpc.Text =
""txtwt.Text =
"" End Sub Private Sub DataGridView1_RowsRemoved(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewRowsRemovedEventArgs) Handles DataGridView1.RowsRemoved Call calgstone() 'Call caltotal() End Sub Private Sub cbstnameid_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbstnameid.SelectedIndexChanged End SubEnd
Class