Public WithEvents suppsource As BindingSource
Dim ds As DataSet
Private Sub viewall_supp()
Try
Me.DataGridView1.AllowUserToAddRows = False
Dim con As New OracleConnection("User Id=shweja;Password=shweja")
con.Open()
Dim adp As OracleDataAdapter
Dim ds As DataSet
Dim cmd As New OracleCommand
adp = New OracleDataAdapter
ds = New DataSet
adp.SelectCommand = New OracleCommand
adp.SelectCommand.Connection = con
adp.SelectCommand.CommandText = "select * from supplier"
ds = New DataSet
adp.Fill(ds, "supplier")
DataGridView1.DataSource = ds.Tables(0)
cmd.Connection = con
cmd.CommandText = "select count(*) from supplier"
Dim I As Integer
I = cmd.ExecuteScalar()
rec.Text = I
suppsource = New BindingSource(ds, "supplier")
suppsource.Sort = "sid"
DataGridView1.DataSource = suppsource
txtcid.DataBindings.Clear()
txtcid.DataBindings.Add("Text", suppsource, "Sid")
nm.DataBindings.Clear()
nm.DataBindings.Add("Text", suppsource, "Name")
snm.DataBindings.Clear()
snm.DataBindings.Add("Text", suppsource, "Surname")
cn1.DataBindings.Clear()
cn1.DataBindings.Add("Text", suppsource, "ContactNo1")
cn2.DataBindings.Clear()
cn2.DataBindings.Add("Text", suppsource, "ContactNo2")
cn3.DataBindings.Clear()
cn3.DataBindings.Add("Text", suppsource, "ContactNo3")
cn4.DataBindings.Clear()
cn4.DataBindings.Add("Text", suppsource, "ContactNo4")
con.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
DataGridView1.Refresh()
End Sub
this code fills the textboxes wen form loaded....my order form shud work in a similar manner...
the create query fro customer,design & order are:
create table customer(custId int primary key,Name varchar(30),Surname varchar(30),Address varchar(50), mobNo int, landNo int);
create table Design(desgId int primary key, design_type varchar(30) not null, image_name varchar(20) not null,image_path varchar(300) not null,Gold_KT int not null,Weight number(4,2) not null, Quantity int not null, MakingCharges number(8,2) not null);
create table orderform(OrderId int , Cid int, OrderDate date not null ,DelDate date not null, DesignType varchar(40) not null ,DesgName varchar(50),DesignId int, Tid int unique,PriceBef number(8,2) not null, TotalPrice number(8,2) ,Vat number(4,2) not null, Finalprice number(8,2) not null, depAmt number(8,2), remAmt number(8,2) , primary key(OrderId), foreign key(DesignId) references Design, foreign key(Cid) references Customer);
im not able to attach apic of my order form so not able to explain wat fields i want...please ask me if u dont understand anything...
This post has been edited by Pooja Mengaji: 10 March 2013 - 09:28 AM

New Topic/Question
Reply



MultiQuote


|