Click here to Skip to main content
15,897,273 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Require help in migrating the VB6 code to VB,NET Pin
DanB19838-May-08 21:47
DanB19838-May-08 21:47 
GeneralRe: Require help in migrating the VB6 code to VB,NET Pin
Chaitanya kumar CVSS8-May-08 21:52
Chaitanya kumar CVSS8-May-08 21:52 
GeneralRe: Require help in migrating the VB6 code to VB,NET Pin
Christian Graus8-May-08 21:55
protectorChristian Graus8-May-08 21:55 
QuestionDatabase not getting updated Pin
vb_buddy8-May-08 20:15
vb_buddy8-May-08 20:15 
AnswerRe: Database not getting updated Pin
Christian Graus8-May-08 20:27
protectorChristian Graus8-May-08 20:27 
GeneralRe: Database not getting updated Pin
Anubhava Dimri8-May-08 20:54
Anubhava Dimri8-May-08 20:54 
GeneralRe: Database not getting updated Pin
vb_buddy9-May-08 20:24
vb_buddy9-May-08 20:24 
GeneralRe: Database not getting updated Pin
vb_buddy9-May-08 20:27
vb_buddy9-May-08 20:27 
Thanks.

Well my table as yet doesnt have the foreign key relationship. This is the code am using at present:

con = connect()
con.Open()

'transaction begins here-------
trans = con.BeginTransaction()

Try

'Data is inserted into mastertable---------

cmd = New SqlClient.SqlCommand("INSERT INTO mastertable(mbno,mbdate,mbamount,mbcperson) VALUES(" & counter_bill_no & ",'" & server_date & "'," & billvalue & "," & countercode & ")", con, trans)
cmd.ExecuteNonQuery()

cmd = New SqlClient.SqlCommand("select mbid from mastertable WHERE mbno=" & counter_bill_no & " and mbcperson=" & countercode & " ", con, trans)
mb_id = cmd.ExecuteScalar

'Data inserted into detailtable-----------

i = 0
For i = 0 To row_no - 1
selling_rate = DataGridView1.Item(2, i).Value
If selling_rate <> 0 Then
cmd = New SqlClient.SqlCommand("INSERT INTO detailtable(dbno,dbdate,dbicode,biquantity,dbamount) VALUES(" & mb_id & ",'" & server_date & "'," & DataGridView1.Item(4, i).Value & "," & DataGridView1.Item(1, i).Value & "," & DataGridView1.Item(3, i).Value & ")", con, trans)
cmd.ExecuteNonQuery()
End If
Next i

'Data commited--------

trans.Commit()

Catch ex As Exception

trans.Rollback()
MsgBox("Bill could not be generated, Please try again.")

End Try

con.Close()

As for Stored Procedures, i dont know much about it, what are the advantage of them.

Regards.
GeneralRe: Database not getting updated Pin
Anubhava Dimri11-May-08 18:23
Anubhava Dimri11-May-08 18:23 
AnswerRe: Database not getting updated Pin
Mycroft Holmes8-May-08 20:50
professionalMycroft Holmes8-May-08 20:50 
GeneralRe: Database not getting updated Pin
vb_buddy9-May-08 20:29
vb_buddy9-May-08 20:29 
QuestionDataset field name in listbox Pin
tchouny8-May-08 20:10
tchouny8-May-08 20:10 
AnswerRe: Dataset field name in listbox Pin
Anubhava Dimri8-May-08 20:44
Anubhava Dimri8-May-08 20:44 
AnswerRe: Dataset field name in listbox Pin
Rupesh Kumar Swami8-May-08 22:14
Rupesh Kumar Swami8-May-08 22:14 
GeneralRe: Dataset field name in listbox Pin
tchouny18-May-08 23:41
tchouny18-May-08 23:41 
Questionwhich control to use on form in vb.net??? Pin
ketan bader8-May-08 19:55
ketan bader8-May-08 19:55 
AnswerRe: which control to use on form in vb.net??? Pin
Anubhava Dimri8-May-08 19:59
Anubhava Dimri8-May-08 19:59 
AnswerRe: which control to use on form in vb.net??? Pin
Dave Kreskowiak9-May-08 1:44
mveDave Kreskowiak9-May-08 1:44 
Question[Message Deleted] Pin
hitesh sojitra8-May-08 19:35
hitesh sojitra8-May-08 19:35 
AnswerRe: How to enable folder permissions after using .Deny in Vb,Net Pin
Christian Graus8-May-08 19:46
protectorChristian Graus8-May-08 19:46 
QuestionHow to get Domainname/user information Pin
hitesh sojitra8-May-08 18:44
hitesh sojitra8-May-08 18:44 
AnswerRe: How to get Domainname/user information Pin
Sam Xavier8-May-08 19:18
Sam Xavier8-May-08 19:18 
GeneralRe: How to get Domainname/user information Pin
hitesh sojitra8-May-08 19:28
hitesh sojitra8-May-08 19:28 
GeneralRe: How to get Domainname/user information Pin
Anubhava Dimri8-May-08 20:10
Anubhava Dimri8-May-08 20:10 
QuestionIncrement of Alphabetic nos(A to Z) Pin
monika_vasvani8-May-08 17:16
monika_vasvani8-May-08 17:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.