Home All Groups Group Topic Archive Search About

How to insert data into wider table

Author
5 Nov 2007 11:51 AM
LM
There are two tables. First with fields "ProductID, ProductName and
Price", in other table there is also "NumberOItems".

How can I do this. Is it an extra field in sql query.

Here is my other code.

   Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
        Dim luku As Double
        Dim conn As New SqlConnection("Data
Source=DV2\SQLEXPRESS;Initial Catalog=testaus;Integrated_
Security=True")
        Dim cmd As New SqlCommand("insert dbo.ost select * FROM
dbo.Tuot WHERE_ Tuotekoodi=@Tuotekoodi", conn)

        Dim param As New SqlParameter()
        param.Direction = ParameterDirection.Input
        param.ParameterName = "@Tuotekoodi"
        param.SqlDbType = SqlDbType.VarChar
        param.SqlValue() = Tuotekoodi
        cmd.Parameters.Add(param)
        cmd.Connection.Open()
        luku = cmd.ExecuteNonQuery()
        cmd.Connection.Close()
    End Sub

I have not decided yet how to get the amount, but let say it is a
number variable initialized as "1".

AddThis Social Bookmark Button