E
evandela
I am having pretty much of the same problem but with an access
Database. When I insert a new product, I need to update a second
reference table with the primary key of the new insert. I have included
my code below to make it a little clearer... if anyone can offer me any
help here - it would be REALLY appreciated.
Protected Sub addNew_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
AccessDataSource1.InsertCommand = "INSERT INTO product
(productName,productPartNumber,productNSNNumber,productDescription)
VALUES ('New Product','1234567890','1234567890','New Product
Description')"
AccessDataSource1.Insert()
AccessDataSource1.InsertCommand = "INSERT INTO
countryProductCost(countryID,productID,cost) VALUES ('1',' <NEED TO
INSERT THE primary key of the insert performed above here> ','0')"
End Sub
</script>
<asp:Button ID="btnAddProduct" runat="server" Text="Add Product"
OnClick="btnAddProduct_Click" /><br />
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="App_Data\products.mdb" />
Anyone have any ideas, they would be really appreciated.
Database. When I insert a new product, I need to update a second
reference table with the primary key of the new insert. I have included
my code below to make it a little clearer... if anyone can offer me any
help here - it would be REALLY appreciated.
Protected Sub addNew_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
AccessDataSource1.InsertCommand = "INSERT INTO product
(productName,productPartNumber,productNSNNumber,productDescription)
VALUES ('New Product','1234567890','1234567890','New Product
Description')"
AccessDataSource1.Insert()
AccessDataSource1.InsertCommand = "INSERT INTO
countryProductCost(countryID,productID,cost) VALUES ('1',' <NEED TO
INSERT THE primary key of the insert performed above here> ','0')"
End Sub
</script>
<asp:Button ID="btnAddProduct" runat="server" Text="Add Product"
OnClick="btnAddProduct_Click" /><br />
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="App_Data\products.mdb" />
Anyone have any ideas, they would be really appreciated.