Microsoft
Software
Hardware
Network
Question : Asp.Net Have trouble adding a row.Cells(1).Text valuse into my insert statement
this line works:
<?xml:namespace prefix = asp /><asp:SqlDataSource id=UploadPictureDataSource
" runat="server">
InsertCommand="INSERT INTO [CustomerImages] ([ImageID],[EquipmentID], [Title], [ImageData], MIMEType)
VALUES (@ImageId, (SELECT [EquipmentID] FROM Equipment WHERE ID = '23'), @Title, @ImageData, @MIMEType)" >
</asp:SqlDataSource>
this line Fails:
<asp:SqlDataSource id=UploadPictureDataSource
" runat="server">
InsertCommand="INSERT INTO [CustomerImages] ([ImageID],[EquipmentID], [Title], [ImageData], MIMEType)
VALUES (@ImageId, (SELECT [EquipmentID] FROM Equipment WHERE ID = '" + row.Cells(1).Text + "'), @Title, @ImageData, @MIMEType)" ></asp:SqlDataSource></asp
:SqlDataSo
urce>
this line also fails:
<asp:SqlDataSource
" runat="server"><asp:SqlDat
aSource
" runat="server">InsertComma
nd="INSERT
INTO [CustomerImages] ([ImageID],[EquipmentID], [Title], [ImageData], MIMEType)
VALUES (@ImageId, (SELECT [EquipmentID] FROM Equipment WHERE ID = " + row.Cells(1).Text + "), @Title, @ImageData, @MIMEType)" ></asp:SqlDataSource></asp
:SqlDataSo
urce>
this gets the row ID value: on what ever row I've selected
Sub GridView2_SelectedIndexCha
nged(ByVal
sender As Object, ByVal e As EventArgs)
' Get the currently selected row using the SelectedRow property.
Dim row As GridViewRow = GridView2.SelectedRow
MessageLabel.Text = "You selected row ID = " & row.Cells(1).Text & "."
End Sub
this prints out the row:
<asp:label id="MessageLabel" forecolor="Red" runat="server"/>
You selected row ID = 23
Answer : Asp.Net Have trouble adding a row.Cells(1).Text valuse into my insert statement
select userID, anumber, title, price, comments from cars where userID=$userID
union all
select userID, anumber, title, price, comments from boats where userID=$userID
...
etc
Random Solutions
Mail stuck in Lotus oubox
video driver - cannot find correct one - aspect 8640 laptop
Exporting mailboxes to PST in Exchange 2007 running on SBS 2008
SCCM Operating System Deployment with SCCM and Multiple Model's of HP Notebooks
How to retrieve and Entities Form or View Metadata
Documentation for Palo Alto PA 500 firewall
mount: unknown filesystem type 'vfat'
Exchange 2010 Domain Prep
Binding List<Class> to DropDownList C#
Gigabit Lan only connecting at 10Mbps... Help!