edfreels
asked on
Passing nodeid to upload command button
Hey All,
I have a listbox that generates state stores. When the user clicks on the stores it gets the nodeid by this code.
Private Sub ListBox1_SelectedIndexChan ged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChan ged
Dim connectionString As String = _
"Data Source=WHSQL2K301;Initial Catalog=WilcoIntranet;Pers ist Security Info=True;User ID=coldfusion;Password=col dfusion"
Dim cn As New SqlClient.SqlConnection(co nnectionSt ring)
Dim da As New SqlClient.SqlDataAdapter()
da.SelectCommand = New SqlClient.SqlCommand()
With da.SelectCommand
.Connection = cn
.CommandType = CommandType.Text
'You need to change the CommandText Select Statement
' Change "NodeID" to the nodeID column name
' Change "StoreName " to the nodeID column name
' Change "StoresTable " to the name of the table in your database
.CommandText = _
"SELECT NodeID, NodeNbr FROM Node ORDER BY NodeName"
End With
Me.ListBox1.DisplayMember = "NodeName"
Me.ListBox1.ValueMember = "NodeID"
End Sub
This is the problem Dim destinationFolder As String = "\\fileserver1\wilcointran et\marketi ngpromotio n\st<nodei d>"
I need something there that will put a wildcard in the st<nodeid> so it will know what nodeid to go to from the listbox we made. If I put it in above it says "illegal characters" because of the <nodeid>
Here is that code.
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
Dim destinationFolder As String = "\\fileserver1\wilcointran et\marketi ngpromotio n\"
Dim files As String() = Me.TextBox5.Text.Split(vbC rLf)
For Each file As String In files
'Remove unwanted character
file = file.Replace(Chr(10), "")
If file.Trim() <> "" Then
'copy file
My.Computer.FileSystem.Cop yFile(file , _
IO.Path.Combine(destinatio nFolder, IO.Path.GetFileName(file)) , _
True)
End If
Next
MsgBox("done")
End Sub
Thanks
I have a listbox that generates state stores. When the user clicks on the stores it gets the nodeid by this code.
Private Sub ListBox1_SelectedIndexChan
Dim connectionString As String = _
"Data Source=WHSQL2K301;Initial Catalog=WilcoIntranet;Pers
Dim cn As New SqlClient.SqlConnection(co
Dim da As New SqlClient.SqlDataAdapter()
da.SelectCommand = New SqlClient.SqlCommand()
With da.SelectCommand
.Connection = cn
.CommandType = CommandType.Text
'You need to change the CommandText Select Statement
' Change "NodeID" to the nodeID column name
' Change "StoreName " to the nodeID column name
' Change "StoresTable " to the name of the table in your database
.CommandText = _
"SELECT NodeID, NodeNbr FROM Node ORDER BY NodeName"
End With
Me.ListBox1.DisplayMember = "NodeName"
Me.ListBox1.ValueMember = "NodeID"
End Sub
This is the problem Dim destinationFolder As String = "\\fileserver1\wilcointran
I need something there that will put a wildcard in the st<nodeid> so it will know what nodeid to go to from the listbox we made. If I put it in above it says "illegal characters" because of the <nodeid>
Here is that code.
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
Dim destinationFolder As String = "\\fileserver1\wilcointran
Dim files As String() = Me.TextBox5.Text.Split(vbC
For Each file As String In files
'Remove unwanted character
file = file.Replace(Chr(10), "")
If file.Trim() <> "" Then
'copy file
My.Computer.FileSystem.Cop
IO.Path.Combine(destinatio
True)
End If
Next
MsgBox("done")
End Sub
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER