Click here to Skip to main content
15,885,767 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Intercept e Send ALT+F1 Pin
Dave Kreskowiak1-Mar-11 8:58
mveDave Kreskowiak1-Mar-11 8:58 
GeneralRe: Intercept e Send ALT+F1 Pin
starcomsis1-Mar-11 9:20
starcomsis1-Mar-11 9:20 
GeneralRe: Intercept e Send ALT+F1 Pin
Dave Kreskowiak1-Mar-11 14:46
mveDave Kreskowiak1-Mar-11 14:46 
QuestionHow to set parallel port in VB programming? Pin
saathis1-Mar-11 4:22
saathis1-Mar-11 4:22 
AnswerRe: How to set parallel port in VB programming? Pin
DaveAuld1-Mar-11 4:57
professionalDaveAuld1-Mar-11 4:57 
AnswerRe: How to set parallel port in VB programming? Pin
Luc Pattyn1-Mar-11 6:10
sitebuilderLuc Pattyn1-Mar-11 6:10 
AnswerRe: How to set parallel port in VB programming? Pin
glennPattonWork32-Mar-11 21:55
professionalglennPattonWork32-Mar-11 21:55 
QuestionHow to save SQL Server 2008 Multiple Tables [modified] Pin
Paramu197328-Feb-11 3:09
Paramu197328-Feb-11 3:09 
Hi,
I have a select query like this

But from the below codes, I cannot update t2.unit_price in the same SqlDataAdapter

My Codes :
--------------------------------------------------------------------------------------------------------------------------------------
Dim MyQuery1 as String="Select t1.item_id,t1,group_id,t2.unit_price from Table1 t1 left outer join Table2 t2 on T1.Item_ID=T2.Item_ID"
Dim DAp1 as SqlDataAdapter,Ds1 as New DataSet

Con.Open()
DataAdapter1=New SqlDataAdapter(MyQuery1,Con)
DataAdapter1.Fill(Ds1)
Con.Close()

Dim Sav1 As String = "insert into table1 (item_id,group_id,????????unit_price) values (@item_id,@group_id,?????????@unit_price)"
Dim Sav2 As String = "update table1 set item_id=@item_id,group_id=@group_id,???????unit_price=@unit_price where item_id=@item_id"

DAp1.InsertCommand = New SqlCommand(Sav1, con)
DAp1.UpdateCommand = New SqlCommand(Sav2, con)

With DAp1.InsertCommand.Parameters
     .Add("@item_id", SqlDbType.VarChar, 15, "item_id")
     .Add("@group_id", SqlDbType.VarChar, 5, "group_id")
???????????     .Add("@unit_price", SqlDbType.Decimal, 18, "unit_price")
End With

With DAp1.UpdateCommand.Parameters
     .Add("@item_id", SqlDbType.VarChar, 15, "item_id")
     .Add("@group_id", SqlDbType.VarChar, 5, "group_id")
????????     .Add("@unit_price", SqlDbType.Decimal, 18, "unit_price")
End With 

con.ConnectionString = ConStr_2
con.Open()
    Dim Trans1 As SqlTransaction
    Trans1 = con.BeginTransaction
    DAp1.UpdateCommand.Transaction = Trans1
    DAp1.InsertCommand.Transaction = Trans1

            Try
                MyDataGrid1.CurrentCell = MyDataGrid1.FirstDisplayedCell
                MyDataGrid1.EndEdit()
                DAp1.Update(Ds1.Tables(0))
                Trans1.Commit()
            Catch ex As Exception
                If Not Trans1 Is Nothing Then
                    Trans1.Rollback()
                End If
                MsgBox(ex.Message)
            End Try
con.close()

-------------------------------------------------------------------------------------------------------------------------------------


From the above codes

Dim Sav1 As String = "insert into table1 .........."

I don't know how to mention table2 also there ?

Thanks For The IdeasThumbs Up | :thumbsup:


Thanks and Regards Rose | [Rose]
PARAMU

modified on Monday, February 28, 2011 10:42 AM

AnswerRe: How to save SQL Server 2008 Multiple Tables Pin
DaveAuld28-Feb-11 4:07
professionalDaveAuld28-Feb-11 4:07 
GeneralRe: How to save SQL Server 2008 Multiple Tables Pin
Paramu197328-Feb-11 4:49
Paramu197328-Feb-11 4:49 
GeneralRe: How to save SQL Server 2008 Multiple Tables Pin
DaveAuld28-Feb-11 5:03
professionalDaveAuld28-Feb-11 5:03 
GeneralRe: How to save SQL Server 2008 Multiple Tables Pin
Paramu197328-Feb-11 7:22
Paramu197328-Feb-11 7:22 
AnswerRe: How to save SQL Server 2008 Multiple Tables Pin
Dave Kreskowiak28-Feb-11 8:07
mveDave Kreskowiak28-Feb-11 8:07 
GeneralRe: How to save SQL Server 2008 Multiple Tables Pin
Luc Pattyn28-Feb-11 9:08
sitebuilderLuc Pattyn28-Feb-11 9:08 
GeneralRe: How to save SQL Server 2008 Multiple Tables Pin
Paramu197328-Feb-11 18:30
Paramu197328-Feb-11 18:30 
QuestionCDO mails in proxy network Pin
WinCrs27-Feb-11 20:25
WinCrs27-Feb-11 20:25 
AnswerRe: CDO mails in proxy network Pin
WinCrs28-Feb-11 0:25
WinCrs28-Feb-11 0:25 
GeneralRe: CDO mails in proxy network Pin
Dave Kreskowiak28-Feb-11 8:02
mveDave Kreskowiak28-Feb-11 8:02 
QuestionHow to configure the directory name in vba excel code Pin
priyaahh27-Feb-11 17:19
priyaahh27-Feb-11 17:19 
AnswerRe: How to configure the directory name in vba excel code Pin
Eddy Vluggen27-Feb-11 22:02
professionalEddy Vluggen27-Feb-11 22:02 
Questionscaling the picturebox size the same as a whiteboard Pin
batanglangka26-Feb-11 10:06
batanglangka26-Feb-11 10:06 
AnswerRe: scaling the picturebox size the same as a whiteboard Pin
Henry Minute26-Feb-11 11:23
Henry Minute26-Feb-11 11:23 
AnswerRe: scaling the picturebox size the same as a whiteboard Pin
DaveAuld27-Feb-11 1:21
professionalDaveAuld27-Feb-11 1:21 
Questiondrag drop icon with picturebox in vb6 Pin
ainie8625-Feb-11 5:11
ainie8625-Feb-11 5:11 
AnswerRe: drag drop icon with picturebox in vb6 Pin
Henry Minute26-Feb-11 11:28
Henry Minute26-Feb-11 11:28 

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.