Sending Multiple Values From A ListBox To ControlParameter

Dec 15, 2005

Any ideas on how I can send multiple values from a listbox to a stored procedure?  right now I have a ListBox Control called lbCategory, and I want to pass multiple selected items to a stored procedure.  

<asp:SqlDataSource ID="dsFS" runat="server" ConnectionString="someConnectionString" SelectCommand="usp_FS" SelectCommandType="StoredProcedure">

<SelectParameters>

<asp:ControlParameter ControlID="lbCategory" DefaultValue="%" Name="category" PropertyName="SelectedValue" type="String" />

</SelectParameters>

</asp:SqlDataSource>

View 5 Replies


ADVERTISEMENT

How To Save Listbox Multiple Select Values

Jan 11, 2005

Hi,

I have an ASP.NET form that stores it's data in MSDE but I just added a multi-select ListBox to the form and I'm having a hard time coming up with a way of writing that data to the database. Should I write the values into a column on the same table where I store the rest of the data from the form (values separated by a comma) or shouild I create another table (one to many) and store the data there. I like the second option, but I'm not sure how to loop through each value and write it to the database table.

I grab the values for the selection as follow:

foreach (ListItem lstItem in lbAttendees.Items)
{
if (lstItem.Selected == true)
{
grpList.Add(lstItem.Value.ToString());
}
}

but I'm not sure on what to do next and could use some help.

Thanks
Germano

View 3 Replies View Related

Passing Multiple Values From A Listbox Into A Stored Procedure

Dec 9, 2007

hi i have a listbox with selectedmode = multiple, i am currently using this code in my code behind (c#) to call the storedprocedure within the datasource but its not working: Do i have to write specific code in c# to send the mulitple values through?protected void confButton_Click(object sender, EventArgs e)
{
try
{foreach (ListItem item in authorsListBox4.Items)
{if (item.Selected)
{
AddConfSqlDataSource.Insert();
}
}saveStatusLabel.Text = "Save Successfull: The above publication has been saved";
}catch (Exception ex)
{saveStatusLabel.Text = "Save Failed: The above publication failed to save" + ex.Message;
}
}

View 3 Replies View Related

Why Wont This Multiple Selection Listbox Insert Values Into Db

Jan 19, 2008

Hi, im a newbie. using VB.net / visual studio 2005 and SQL express
I have pasted my page code below
Basically i have a lisbox which is bound to an sqldatasource.  It allows the user to select multiple names.  I then have another datasource which when the page is submitted it posts various values from different fields into my db.  The insert works fine.My problem is that the multiple selection wont allow me to insert into my db, it just captures the first value.I used this sub below to prove  that when i click a button on my page it takes all my selected choices and puts them inside a text box, this works i can see them all.  I then bound the textbox text value to the one im inserting into the db, however once again its only inserting the first value from the text box, how is this possible, the text box shows all the values and its set to string, it should insert everything in the text box Protected Sub selectedContact_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim alternatives As ListBox = CType(UploadPictureUI.FindControl("alternatives"), ListBox)
Dim TextBox1 As TextBox = CType(UploadPictureUI.FindControl("TextBox1"), TextBox)
For intLoopIndex As Integer = 0 To alternatives.Items.Count - 1
If alternatives.Items(intLoopIndex).Selected Then
TextBox1.Text &= alternatives.Items(intLoopIndex).Text & _
ControlChars.CrLf
End If
Next
End Sub
 Here is my full page code
 1 <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" Title="Create Profile" Debug="true" %>
2 <script runat="server">
3 Protected Sub UploadPictureUI_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertEventArgs) Handles UploadPictureUI.ItemInserting
4 'Reference the FileUpload control
5 Dim UploadedFile As FileUpload = CType(UploadPictureUI.FindControl("UploadedFile"), FileUpload)
6
7 'Make sure a file has been successfully uploaded
8 If UploadedFile.PostedFile Is Nothing OrElse String.IsNullOrEmpty(UploadedFile.PostedFile.FileName) OrElse UploadedFile.PostedFile.InputStream Is Nothing Then
9 ShowErrorMessage("No file was uploaded. Please make sure that you've selected a file to upload.")
10 e.Cancel = True
11 Exit Sub
12 End If
13
14 'Make sure we are dealing with a JPG or GIF file
15 Dim extension As String = Path.GetExtension(UploadedFile.PostedFile.FileName).ToLower()
16 Dim MIMEType As String = Nothing
17
18 Select Case extension
19 Case ".gif"
20 MIMEType = "image/gif"
21 Case ".jpg", ".jpeg", ".jpe"
22 MIMEType = "image/jpeg"
23 Case ".png"
24 MIMEType = "image/png"
25
26 Case Else
27 'Invalid file type uploaded
28 ShowErrorMessage("Only GIF, JPG, and PNG files can be uploaded.")
29 e.Cancel = True
30 Exit Sub
31 End Select
32
33 'Specify the values for the MIMEType and ImageData parameters
34 e.Values("MIMEType") = MIMEType
35
36 'Load FileUpload's InputStream into Byte array
37 Dim imageBytes(UploadedFile.PostedFile.InputStream.Length) As Byte
38 UploadedFile.PostedFile.InputStream.Read(imageBytes, 0, imageBytes.Length)
39 e.Values("imageData") = imageBytes
40 End Sub
41
42 Private Sub ShowErrorMessage(ByVal msg As String)
43 ErrorMessage.Text = msg
44 ErrorMessage.Visible = True
45 End Sub
46
47 Protected Sub UploadPictureUI_ItemInserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertedEventArgs) Handles UploadPictureUI.ItemInserted
48 'If item successfully inserted, send user back to default
49 If e.Exception Is Nothing Then
50 Response.Redirect("~/confirmation.aspx")
51 End If
52 End Sub
53
54 Protected Sub selectedContact_Click(ByVal sender As Object, ByVal e As System.EventArgs)
55 Dim alternatives As ListBox = CType(UploadPictureUI.FindControl("alternatives"), ListBox)
56 Dim TextBox1 As TextBox = CType(UploadPictureUI.FindControl("TextBox1"), TextBox)
57 For intLoopIndex As Integer = 0 To alternatives.Items.Count - 1
58 If alternatives.Items(intLoopIndex).Selected Then
59 TextBox1.Text &= alternatives.Items(intLoopIndex).Text & _
60 ControlChars.CrLf
61 End If
62 Next
63 End Sub
64
65
66 </script>
67 <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
68 <table border="0" cellpadding="0" cellspacing="0" style="vertical-align: middle;
69 width: 795px; text-align: center">
70 <tr>
71 <td align="center" style="height: 650px" valign="middle">
72 <asp:DetailsView ID="UploadPictureUI" runat="server" AutoGenerateRows="False" CssClass="createProfile"
73 DataKeyNames="id" DataSourceID="accessProfiles" GridLines="None" DefaultMode="Insert">
74 <Fields>
75 <asp:TemplateField HeaderText="Create Profile">
76 <InsertItemTemplate>
77 <table style="width: 350px">
78 <tr>
79 <td align="center" style="width: 150px; height: 30px">
80 Name:</td>
81 <td align="center" style="width: 200px; height: 30px">
82 <asp:TextBox ID="Nametxtbx" runat="server" CssClass="textboxstyle" Text='<%# Bind("Name") %>' MaxLength="20"></asp:TextBox>
83 <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="Nametxtbx"
84 CssClass="errorMessage" ErrorMessage="First Name is Required" ForeColor="">*</asp:RequiredFieldValidator></td>
85 </tr>
86 <tr>
87 <td align="center" style="width: 150px; height: 30px">
88 Email:</td>
89 <td align="center" style="width: 200px; height: 30px">
90 <asp:TextBox ID="emailtxtbx" runat="server" CssClass="textboxstyle" Text='<%# Bind("email") %>'></asp:TextBox>
91 <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="emailtxtbx"
92 CssClass="errorMessage" ErrorMessage="Email Address is Required" ForeColor="">*</asp:RequiredFieldValidator>
93 <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="emailtxtbx"
94 ErrorMessage="RegularExpressionValidator" ForeColor="" ValidationExpression="w+([-+.']w+)*@w+([-.]w+)*.w+([-.]w+)*">*</asp:RegularExpressionValidator></td>
95 </tr>
96 <tr>
97 <td align="center" style="width: 150px; height: 30px">
98 Mobile:</td>
99 <td align="center" style="width: 200px; height: 30px">
100 &nbsp;<asp:TextBox ID="mobiletxtbx" runat="server" CssClass="textboxstyle" Text='<%# Bind("mobile") %>' MaxLength="11"></asp:TextBox>
101 <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="mobiletxtbx"
102 CssClass="errorMessage" ErrorMessage="Mobile Number is Required" ForeColor="">*</asp:RequiredFieldValidator>
103 </td>
104 </tr>
105 <tr>
106 <td align="center" style="width: 150px; height: 30px">
107 Extension:</td>
108 <td align="center" style="width: 200px; height: 30px">
109 <asp:TextBox ID="extensiontxtbox" runat="server" CssClass="textboxstyle" Text='<%# Bind("extension") %>' MaxLength="11"></asp:TextBox>
110 <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="extensiontxtbox"
111 CssClass="errorMessage" ErrorMessage="Phone Extension is Required" ForeColor="">*</asp:RequiredFieldValidator></td>
112 </tr>
113 <tr>
114 <td align="center" style="width: 150px; height: 30px">
115 Alternative Contact:</td>
116 <td align="center" style="width: 200px; height: 30px">
117 <asp:ListBox ID="alternatives" runat="server" CssClass="listboxstyle"
118 DataSourceID="getAlternatives" DataTextField="Name" DataValueField="Name" SelectedValue='<%# Bind("alternativeContact") %>'
119 SelectionMode="Multiple"></asp:ListBox>
120 <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="alternatives"
121 CssClass="errorMessage" ErrorMessage="Alternative Contact is Required" ForeColor="">*</asp:RequiredFieldValidator></td>
122 </tr>
123 <tr>
124 <td align="center" style="width: 150px; height: 30px">
125 Job Role:</td>
126 <td align="center" style="width: 200px; height: 30px">
127 <asp:DropDownList ID="DropDownList2" runat="server" CssClass="dropdownliststyle" DataSourceID="accessrole"
128 DataTextField="role" DataValueField="roleID" AppendDataBoundItems="True" SelectedValue='<%# Bind("roleID") %>'>
129 <asp:ListItem Value="" Selected="False">- Please Select -</asp:ListItem>
130 </asp:DropDownList>
131 <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="DropDownList1"
132 CssClass="errorMessage" ErrorMessage="Job Role is Required" ForeColor="">*</asp:RequiredFieldValidator></td>
133 </tr>
134 <tr>
135 <td align="center" style="width: 150px; height: 30px">
136 Responsibilities:</td>
137 <td align="center" style="width: 200px; height: 30px">
138 <asp:TextBox ID="resposibilities" runat="server" CssClass="textareastyle" Text='<%# Bind("responsibilities") %>'
139 TextMode="MultiLine" MaxLength="200"></asp:TextBox>
140 <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="resposibilities"
141 CssClass="errorMessage" ErrorMessage="Role Responsibilities are Required" ForeColor="">*</asp:RequiredFieldValidator></td>
142 </tr>
143 <tr>
144 <td align="center" style="width: 150px; height: 29px">
145 Hobbies:</td>
146 <td align="center" style="width: 200px; height: 29px">
147 <asp:TextBox ID="hobbiestxtbx" runat="server" CssClass="textareastyle" Text='<%# Bind("hobbies") %>'
148 TextMode="MultiLine" MaxLength="200"></asp:TextBox></td>
149 </tr>
150 <tr>
151 <td align="center" style="width: 150px; height: 30px">
152 Team Name:</td>
153 <td align="center" style="width: 200px; height: 30px">
154 <asp:DropDownList ID="DropDownList1" runat="server" CssClass="dropdownliststyle" DataSourceID="accessTeam"
155 DataTextField="TeamName" DataValueField="TeamID" AppendDataBoundItems="True" SelectedValue='<%# Bind("TeamID") %>'>
156 <asp:ListItem Value="" Selected="False">- Please Select -</asp:ListItem>
157 </asp:DropDownList>
158 <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ControlToValidate="DropDownList2"
159 CssClass="errorMessage" ErrorMessage="Team Name is Required" ForeColor="">*</asp:RequiredFieldValidator></td>
160 </tr>
161 <tr>
162 <td align="center" style="width: 150px; height: 30px">
163 I am a Manager:</td>
164 <td align="center" style="width: 200px; height: 30px">
165 <asp:CheckBox ID="isManager" runat="server" Checked='<%# Bind("isManager") %>' Text="Yes" /></td>
166 </tr>
167 <tr>
168 <td align="center" style="width: 150px; height: 30px">
169 I am a Team Manager:</td>
170 <td align="center" style="width: 200px; height: 30px"><asp:CheckBox ID="isTeamManager" runat="server" Checked='<%# Bind("isTeamManager") %>' Text="Yes" /></td>
171 </tr>
172 <tr>
173 <td align="center" style="width: 150px; height: 30px">
174 MyManager is:</td>
175 <td align="center" style="width: 200px; height: 30px">
176 <asp:DropDownList ID="myManagerIs" runat="server" CssClass="dropdownliststyle" DataSourceID="MyManager"
177 DataTextField="Name" DataValueField="id" AppendDataBoundItems="true" SelectedValue='<%# Bind("teamManagerID") %>'>
178 <asp:ListItem Value="" Selected="False">- Please Select -</asp:ListItem>
179 </asp:DropDownList>
180 </td>
181 </tr>
182 <tr>
183 <td align="center" style="width: 150px; height: 30px">
184 Upload Image:</td>
185 <td align="center" style="width: 200px; height: 30px">
186 <asp:FileUpload ID="UploadedFile" runat="server"
187 Width="150px" />&nbsp;</td>
188 </tr>
189 <tr>
190 <td align="center" style="width: 150px; height: 30px">
191 Image Title:</td>
192 <td align="center" style="width: 200px; height: 30px">
193 <asp:TextBox ID="imagetitle" runat="server" CssClass="textboxstyle" Text='<%# Bind("imageTitle") %>' MaxLength="30"></asp:TextBox>
194 <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="imagetitle"
195 CssClass="errorMessage" ErrorMessage="Image Title is Required" ForeColor="">*</asp:RequiredFieldValidator></td>
196 </tr>
197 <tr>
198 <td align="center" style="width: 150px; height: 30px">
199 Hide This Profile:</td>
200 <td align="center" style="width: 200px; height: 30px">
201 <asp:CheckBox ID="profileHide" runat="server" Checked='<%# Bind("Display") %>' /></td>
202 </tr>
203 <tr>
204 <td align="center" colspan="2" style="height: 30px">
205 <asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("alternativeContact") %>'></asp:TextBox><br />
206 <asp:LinkButton ID="selectedContact" runat="server" OnClick="selectedContact_Click" OnClientClick="selectedContact_Click">Add Selected Contacts</asp:LinkButton></td>
207 </tr>
208 <tr>
209 <td align="center" colspan="2" style="height: 30px">
210 <asp:ValidationSummary ID="ValidationSummary1" runat="server" CssClass="errorMsgstyle"
211 ForeColor="" />
212 </td>
213 </tr>
214 </table>
215 </InsertItemTemplate>
216 <HeaderTemplate>
217 &nbsp;
218 </HeaderTemplate>
219 </asp:TemplateField>
220 <asp:TemplateField ShowHeader="False">
221 <EditItemTemplate>
222 &nbsp;
223 </EditItemTemplate>
224 <InsertItemTemplate>
225 <asp:LinkButton ID="btnInsert" runat="server" CausesValidation="True" CommandName="Insert"
226 Text="Insert"></asp:LinkButton>
227 <asp:LinkButton ID="btnCancel" runat="server" CausesValidation="False" CommandName="Cancel"
228 Text="Cancel"></asp:LinkButton>
229 </InsertItemTemplate>
230 <ItemTemplate>
231 &nbsp;
232 </ItemTemplate>
233 </asp:TemplateField>
234 </Fields>
235 </asp:DetailsView>
236 <br />
237 <asp:Label ID="ErrorMessage" runat="server" CssClass="errortext"></asp:Label>&nbsp;<br />
238 &nbsp;
239 &nbsp; &nbsp;&nbsp;</td>
240 </tr>
241 <tr>
242 <td style="width: 100px">
243 <asp:SqlDataSource ID="accessProfiles" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
244 InsertCommand="INSERT INTO [employeeDetails] ([isManager], [isTeamManager], [Name], [RoleID], , [extension], [mobile], [alternativeContact], [imageTitle], [imageMimeType], [imageData], [TeamID], [Display], [teamManagerID], [responsibilities], [hobbies]) VALUES (@isManager, @isTeamManager, @Name, @RoleID, @email, @extension, @mobile, @alternativeContact, @imageTitle, @MimeType, @imageData, @TeamID, @Display, @teamManagerID, @responsibilities, @hobbies)" >
245 <InsertParameters>
246 <asp:Parameter Name="isManager" Type="byte" DefaultValue="0" Size="1" />
247 <asp:Parameter Name="isTeamManager" DefaultValue="0" Size="1" Type="Byte" />
248 <asp:Parameter Name="Name" Type="String" />
249 <asp:Parameter Name="RoleID" Type="Int32" />
250 <asp:Parameter Name="email" Type="String" />
251 <asp:Parameter Name="extension" Type="String" />
252 <asp:Parameter Name="mobile" Type="String" />
253 <asp:Parameter Name="alternativeContact" Type="String" />
254 <asp:Parameter Name="imageTitle" Type="String" />
255 <asp:Parameter Name="MimeType" Type="String" />
256 <asp:Parameter Name="imageData" />
257 <asp:Parameter Name="TeamID" Type="Int32" />
258 <asp:Parameter Name="Display" type="Byte" DefaultValue="1" Size="0" />
259 <asp:Parameter Name="teamManagerID" Type="Int32" />
260 <asp:Parameter Name="responsibilities" Type="String" />
261 <asp:Parameter Name="hobbies" Type="String" />
262 </InsertParameters>
263 </asp:SqlDataSource>
264 <asp:SqlDataSource ID="accessrole" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
265 SelectCommand="SELECT [role], [RoleID] FROM [role] ORDER BY [role] DESC"></asp:SqlDataSource>
266 <asp:SqlDataSource ID="MyManager" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
267 SelectCommand="SELECT id, Name, isManager, isTeamManager FROM employeeDetails WHERE (isManager > 0) OR (isTeamManager > 0) ORDER BY Name DESC">
268 </asp:SqlDataSource>
269 <asp:SqlDataSource ID="accessTeam" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
270 SelectCommand="SELECT [TeamID], [TeamName] FROM [Team] ORDER BY [TeamName] ASC"></asp:SqlDataSource>
271 <asp:SqlDataSource ID="getAlternatives" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
272 SelectCommand="SELECT [Name] FROM [employeeDetails] ORDER BY [Name]"></asp:SqlDataSource>
273 </td>
274 </tr>
275 </table>
276 </asp:Content>
277
278

 
Thanks for your help

View 1 Replies View Related

Sending Messages Which Have Multiple Values

Apr 19, 2008



We're looking to send messages to an SSB Queue (our 'Notification' queue) that contains multiple values.. like Message #1: 20,1 to indicate Record #20, send Notification #1.. the reason for this is we have lots of different types of records in our database, and based on certain conditions, we would like to send different notices regarding these various record types.

What is the best format to send mesages like this? We thought about sending TABLE vars.. what other options are there?

View 3 Replies View Related

Listbox Selected Values

Dec 1, 2005

Hi. With VWD i've produced the following code.<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:50469ConnectionString %>"SelectCommand="SELECT * FROM [ibs] WHERE ([liedID] = @liedID)"><SelectParameters><asp:ControlParameter ControlID="ListBox1" Name="liedID" PropertyName="SelectedValue" Type="Int16" />But the query is only returning one row of the table. Even when multiple values were selected in the ListBox1. Could someone tell me how to do?Thanks, Kin Wei.

View 2 Replies View Related

Use Listbox Values To Do Select Statement

May 20, 2007

Hi,
I have SQL database 2000 which has one table Sheet1, I retrieved the columns in the ListBox, then chosed some of them and moved it to ListBox2.
The past scenario worked great, and I checked the moved values, it was succesfully moved, but when I tried to copy the values in ArrayList to do a select statement it didn't worked at all.
public string str;protected void Button3_Click(object sender, EventArgs e)
{ArrayList itemsSelected = new ArrayList(); string sep = ",";
//string str;for (int i = 0; i < ListBox2.Items.Count; i++)
{if (ListBox2.Items[i].Selected)
{
itemsSelected.Add(ListBox2.Items[i].Value);
}
int itemsSelCount = itemsSelected.Count; // integer variable which holds the count of the selected items.
str = ListBox2.Items[i].Value + sep;
Response.Write(str);
}
 SqlConnection SqlCon = new SqlConnection("Data Source=AJ-166DCCD87;Initial Catalog=stat_rpt;Integrated Security=True;Pooling=False");
String SQL1 = "SELECT " + str + " from Sheet1"; SqlDataAdapter Adptr = new SqlDataAdapter(SQL1, SqlCon);
SqlCommandBuilder CB = new SqlCommandBuilder(Adptr);DataTable Dt = new DataTable();
Adptr.Fill(Dt);
//return Dt;
GridView1.DataBind();
SqlCon.Close();
}
I did some changes and the new error message is
Incorrect syntax near the keyword 'from'.
Thank you

View 6 Replies View Related

Selected Listbox Values In SQL Statement

Jan 9, 2008

I have seen some information on this but have not understood fully the answers.  I am fairly new to this and have spent the afternoon trying to work on this and although I have leant some really cool things I am no nearer.  How do I get selected values from a LIstbox into a SQL statement using the IN command  
First I loop through a List box control to get the multi selected values: Dim li As ListItemFor Each li In lbPClass.Items  If li.Selected = True Then    strPC += li.Value & ", "  End IfNextLabel5.Text = strPC The result in the lable looks something like: 100, 101, 102 , I get rid of the trailing blank and commar with:Label6.Text = Left(Label5.Text, Trim(Len(Label5.Text) - 2)) I have created a parameter called @PROPCLASS that will use the values from the selected values in the listbox in a SQL query using an IN statement: Cmd.Parameters.Add(New OleDbParameter("@PROPCLASS", Label6.Text)) strSQL = "SELECT * FROM web_transfer WHERE ( PROP_CLASS IN (@PROPCLASS)) AND (ACRES >= @lowSize)AND (ACRES < @HighSize)  AND (YEAR = @lowYear)AND (SALE_PRICE > @lowPrice) AND (SALE_PRICE < @highPrice) " 
It is really the first bit of the WHERE clause I am interested in.  The sql statement works if I either type in the actual values IN( 100, 101,102) or if I select only one value in the list box.  If I select two then the sql statement does not work. 
My question is: How do I get the values selected in the List box into my SQL statement   Thank you in advance, s

View 1 Replies View Related

How To Insert All The Values From A Listbox Into The Database?

Jun 29, 2004

I want that the user can chose several options from one ‘listbox’, and to do this, I have created two ‘listbox’, in the first one there are the options to select, and the second one is empty. Then, in order to select the options I want the user have select one or more options from the first ‘listbox’ and then click in a link to pass the options selected to the second ‘listbox’. Thus, the valid options selected will be the text and values in the second ‘listbox’. I have seen this system in some websites, and I think it is very clear.

Well, my question is, Is it possible to insert into the database all the values from a ‘listbox’ control? In my case from the second ‘listbox’ with all the values passed from the first one? If yes, in my database table I have to create one column (field) for every possible selected option?

Thank you,
Cesar

View 3 Replies View Related

Multiple Selection Listbox As Data Control?

Aug 28, 2007

 Hi, i have a listbox with multiple selection enabled, the end user uses this listbox to select what data they want to view eg. they select "green" to view all the green cars, "red" to select all the red cars etc. i have the listbox as the control that is connected to the datasource (the sql used for it is select * from cars_table where color =@colorthis works fine when one item in the listbox is selected, but when multiples are selected it does not work what format does the =@color have to be when multiples are selected? i've tried "green, red" "green + red" etc. but cannot seem to get it workingdoes anybody have any working examples that i can take a look at? it seems to be a common action, yet i cannot seem to find any documentation on how to get it to workthanks in advance! 

View 1 Replies View Related

How Do I Store Multiple Selected Listbox Items

Jan 12, 2008

Hi There
This is probably realy simple but since im still a newbie some help would be appreciated.  I have a listbox bound to an sqldatasource which has names  of people from my sql database employeeDetails table.  I simply want to allow someone to select to select multiple names and insert them into another field in my database. 
I have this bit workng, ie they can select multiple people on the list, it does insert, however only the first selected name, not the others.Can you please help me out
Kind Regads
Dan

View 3 Replies View Related

Using Asp.net Listbox Control (multiple Selection) And Sproc

Oct 6, 2005

I have a form where a user can select multiple items from a listbox control.How can I pass each item selected to a sproc? Do i need to created a paramter for each item in my listbox in my sproc?Has anyone done this, I dont want to create dynamic sql to handle this and i dont really want to create 100 parameters to handle my listbox items.thanks

View 1 Replies View Related

Stop Subsciptions From Sending If The Report Has No Values

Dec 5, 2007

What would be the best way of setting up a subscription to not send, if the report is empty?


Do i need to write a new stored procedure that does a count or something? what would i do on the reporting serivices side?

View 1 Replies View Related

T-SQL (SS2K8) :: Sending Multiple Emails

Oct 9, 2014

I need to send multiple emails to recipients one at a time what is the best way to do this?for example i do a select statement to get 5 email addresses, now i need to be able to fire off an email with verbiage to each one of them separately. The reason they have to be separate is in the verbiage i need to have there name in the 'Dear Jondoe1,' Here is my second dilemma. How would you insert a name in the verbiage for each email?

jondoe1@gmail.com
jondoe2@gmail.com
jondoe3@gmail.com
jondoe4@gmail.com
jondoe5@gmail.com

View 2 Replies View Related

Sending The Same Message To Multiple Servers

Jul 19, 2007

Can anyone outline some best practices for sending the same message out to multiple servers? What is the easiest way to do this?

Currently, I have a message sent from Server A to Server B, which is fired by a table insert, update, delete trigger.

The goal is to keep this table synchronized on many remote servers. It sounds like a tedious exercise to deploy the SSB messages, queues, services, etc to 20+ more sites! I am hoping there is a shortcut of some kind.

Any advice is appreciated.

View 7 Replies View Related

Sending One Message To Multiple Consumers

Feb 14, 2006

Hi Remus

What if I need multiple clients to read (RECEIVE) the same message?

Would it be possible?



Thanks

View 8 Replies View Related

Sending Multiple Sql Statements In One Request, Transaction Safe?

Dec 15, 2007

If I send multiple sql's with ado.net in one statement (one executeSql separated by semilcolons), and the second one fails, will the first one be rolled back? or do I need to put it all in a transaction?

View 1 Replies View Related

Sending Email Reminder To Multiple Users - Cursor Not Working Correctly?

Sep 18, 2014

I am tring to send an email reminder to multiple users using a cursor.

declare emailCursor cursor for
select name,info,default_email, @MyMessage
from My_Temp

open emailCursor
fetch next from emailCursor into @Name,@info, @Recipients,@MyMessage

while(@@FETCH_STATUS = 0)
begin

-- select name,info,ins_default_email,@MyMessage
--from temp

EXEC msdb.dbo.sp_send_dbmail

@profile_name = 'Hello',
@recipients = @Recipients,
@from_address = '<address.com>',
@Body = @MyMessage,
@subject = 'Subject'

fetch next from emailCursor into @Name,@info, @Recipients,@MyMessage

end
close emailCursor
deallocate emailCursor

Currently I have two users in my table that I want to send email to, but when the stored procedure runs I got two emails for the last user in the table instead one for each user.

View 2 Replies View Related

Reporting Services :: Selecting Multiple Parameters Values For Comma Separated Values In SSRS?

Jun 17, 2012

I am SSRS user, We have a .net UI from where we want to pass multi select values, but these values are comma separated in the database. how can I write a sql query such that when I select multi values on my UI, the comma separated values are take care of.

View 5 Replies View Related

Retrieving Multiple Values From One Field In SQL Server For Use In Multiple Columsn In Reports

Mar 30, 2007

I am trying to create a report using Reporting Services.

My problem right now is that the way the table is constructed, I am trying to pull 3 seperate values i.e. One is the number of Hours, One is the type of work, and the 3rd is the Grade, out of one column and place them in 3 seperate columns in the report.

I can currently get one value but how to get the information I need to be able to use in my reports.

So far what I've been working with SQL Reporting Services 2005 I love it and have made several reports, but this one has got me stumped.

Any help would be appreciated.



Thanks.



I might not have made my problem quite clear enough. My table has one column labeled value. The value in that table is linked through an ID field to another table where the ID's are broken down to one ID =Number of Hours, One ID = Grade and One ID= type of work.

What I'm trying to do is when using these ID's and seperate the value related to those ID's into 3 seperate columns in a query for using in Reporting Services to create the report

As you can see, I'm attempting to change the name of the same column 3 times to reflect the correct information and then link them all to the person, where one person might have several entries in the other fields.

As you can see I can change the names individually in queries and pull the information seperately, it's when roll them altogether is where I'm running into my problem

Thanks for the suggestions that were made, I apoligize for not making the problem clearer.

Here is a copy of what I'm attempting to accomplish. I didn't have it with me last night when posting.



--Pulls the Service Opportunity

SELECT cs.value AS "Service Opportunity"

FROM Cstudent cs

INNER JOIN cattribute ca ON ca.attributeid = cs.attributeid

WHERE ca.name = 'Service Opportunity'



--Pulls the Number of Hours

SELECT cs.value AS 'Number of Hours'

FROM Cstudent cs

INNER JOIN cattribute ca ON ca.attributeid =cs.attributeid

WHERE ca.name ='Num of Hours'



--Pulls the Person Grade Level

SELECT cs.value AS 'Grade'

FROM Cstudent cs

INNER JOIN cattribute ca ON ca.attributeid =cs.attributeid

WHERE ca.name ='Grade'



--Pulls the Person Number, First and Last Name and Grade Level

SELECT s.personnumber, s.lastname, s.firstname, cs.value as "Grade"

FROM student s

INNER JOIN cperson cs ON cs.personid = s.personid

INNER JOIN cattribute ca ON ca.attributeid = cs.attributeid

WHERE cs.value =(SELECT cs.value AS 'Grade'

WHERE ca.attributeid = cs.attributeid AND ca.name='Grade')

View 11 Replies View Related

ControlParameter

Jan 23, 2008

I am new to asp.net and this is the first time I have tried to use a ControlParameter from another control and I can not get it to work. FormView1 works as expected, but the controlParameter in SqlDataSource2 does not work as expected.
 A part of FormView1 and SqlDataSource1 (the source)<asp:FormView ID="FormView1" runat="server" DataKeyNames="Id"
DataSourceID="SqlDataSource1"
<ItemTemplate>
<asp:Label ID="lblCategoryName" runat="server" Text='<%# Bind("CategoryName") %>'></asp:Label>
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [Id], [CategoryName], [ItemNumber], [Name], [Price], [SalePrice], [FullDescription], [ImageAltText], [DateSold] FROM [Products] WHERE ([Id] = @Id)">
<SelectParameters>
<asp:QueryStringParameter Name="Id" QueryStringField="Id" DefaultValue="11" />
</SelectParameters>
</asp:SqlDataSource>
 
SqlDataSource2 (where I need to use "lblCategoryName" from FormView1) <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [Id], [CategoryName], [ImageAltText], [DateSold] FROM [Products] WHERE ([CategoryName] = @CategoryName)">
<SelectParameters><asp:ControlParameter ControlID="FormView1"
DefaultValue="Earrings" Name="lblCategoryName"
PropertyName="text" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
I hope someone can help me with my simple problem.
Thank you

View 1 Replies View Related

Multiple Columns With Different Values OR Single Column With Multiple Criteria?

Aug 22, 2007

Hi,

I have multiple columns in a Single Table and i want to search values in different columns. My table structure is

col1 (identity PK)
col2 (varchar(max))
col3 (varchar(max))

I have created a single FULLTEXT on col2 & col3.
suppose i want to search col2='engine' and col3='toyota' i write query as

SELECT

TBL.col2,TBL.col3
FROM

TBL
INNER JOIN

CONTAINSTABLE(TBL,col2,'engine') TBL1
ON

TBL.col1=TBL1.[key]
INNER JOIN

CONTAINSTABLE(TBL,col3,'toyota') TBL2
ON

TBL.col1=TBL2.[key]

Every thing works well if database is small. But now i have 20 million records in my database. Taking an exmaple there are 5million record with col2='engine' and only 1 record with col3='toyota', it take substantial time to find 1 record.

I was thinking this i can address this issue if i merge both columns in a Single column, but i cannot figure out what format i save it in single column that i can use query to extract correct information.
for e.g.;
i was thinking to concatinate both fields like
col4= ABengineBA + ABBToyotaBBA
and in search i use
SELECT

TBL.col4
FROM

TBL
INNER JOIN

CONTAINSTABLE(TBL,col4,' "ABengineBA" AND "ABBToyotaBBA"') TBL1
ON

TBL.col1=TBL1.[key]
Result = 1 row

But it don't work in following scenario
col4= ABengineBA + ABBCorola ToyotaBBA

SELECT

TBL.col4
FROM

TBL
INNER JOIN

CONTAINSTABLE(TBL,col4,' "ABengineBA" AND "ABB*ToyotaBBA"') TBL1
ON

TBL.col1=TBL1.[key]

Result=0 Row
Any idea how i can write second query to get result?

View 1 Replies View Related

Adding Values To A Parameter That Can Take Multiple Values

Jun 6, 2007

If I have a Select statement like this in my C# code:
Select * From foods Where foodgroup In (@foodgroup)
And I want @foodgroup to have these values ... "meat", "dairy", fruit", what is the correct way to add the parameter?
I tried
meat, dairy, fruit
'meat', 'dairy', 'fruit'
but neither worked. Is this possible?

View 2 Replies View Related

'Insert Into' For Multiple Values Given A Table Into Which The Values Need To Go

Sep 1, 2007

Please be easy on me...I haven't touched SQL for a year. Why given;



Code Snippet
USE [Patients]
GO
/****** Object: Table [dbo].[Patients] Script Date: 08/31/2007 22:09:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Patients](
[PID] [int] IDENTITY(1,1) NOT NULL,
[ID] [varchar](50) NULL,
[FirstName] [nvarchar](50) NULL,
[LastName] [nvarchar](50) NULL,
[DOB] [datetime] NULL,
CONSTRAINT [PK_Patients] PRIMARY KEY CLUSTERED
(
[PID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF


do I get

Msg 102, Level 15, State 1, Line 3

Incorrect syntax near ','.
for the following;




Code Snippet
INSERT INTO Patients
(ID, FirstName,LastName,DOB) VALUES
( '1234-12', 'Joe','Smith','3/1/1960'),
( '5432-30','Bob','Jones','3/1/1960');


Thank you,
hazz

View 3 Replies View Related

SqlDataReader - Pulling Multiple Values Into Multiple Variables

Mar 29, 2007

Hello all,I'm trying to request a number of URLS (one for each user) from my database, then place each of these results into a separate string variables. I believed that SqlDataReader could do this for me, but I am unsure of how to accomplish this, or if I am walking down the wrong road. The current code is below (the section in question is in bold), please ignore the fact that I'm using MySQL as the commands work in the same way. public partial class main : System.Web.UI.Page{    String UserName;    String userId;    String HiveConnectionString;    String Current_Location;    ArrayList Location;    public String Location1;    public String Location2;    public String Location3;    //Int32 x = 0;    private void Page_Load(object sender, EventArgs e)    {        if (User.Identity.IsAuthenticated)        {            UserName = Membership.GetUser().ToString();            userId = Membership.GetUser().ProviderUserKey.ToString();            HiveConnectionString = "Database=hive;Data Source=localhost;User Id=hive_admin;Password=West7647";            using (MySql.Data.MySqlClient.MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection(HiveConnectionString))            {                // Map Updates                 MySql.Data.MySqlClient.MySqlCommand Locationcmd = new MySql.Data.MySqlClient.MySqlCommand(                        "SELECT Location FROM tracker WHERE Location = IsOnline = '1'");                Locationcmd.Parameters.Add("?PKID", MySql.Data.MySqlClient.MySqlDbType.VarChar, 255).Value = userId;                Locationcmd.Connection = conn;                conn.Open();                MySql.Data.MySqlClient.MySqlDataReader LocationReader = Locationcmd.ExecuteReader();                 while (LocationReader.Read())                {                        Location1 = LocationReader.GetString(0);                        //Location2 = LocationReader.GetString(1); // This does not work..                }                                LocationReader.Close();                conn.Close();                // IP Display                MySql.Data.MySqlClient.MySqlCommand Checkcmd = new MySql.Data.MySqlClient.MySqlCommand(                        "SELECT UserName FROM tracker WHERE PKID = ?PKID");                Checkcmd.Parameters.Add("?PKID", MySql.Data.MySqlClient.MySqlDbType.VarChar, 255).Value = userId;                Checkcmd.Connection = conn;                conn.Open();                object UserExists = Checkcmd.ExecuteScalar();                conn.Close();                if(UserExists == null)                {                    MySql.Data.MySqlClient.MySqlCommand Insertcmd = new MySql.Data.MySqlClient.MySqlCommand(                        "INSERT INTO tracker (PKID, UserName, IpAddress, IsOnline) VALUES (?PKID, ?Username, ?IpAddress, 1)");                                        Insertcmd.Parameters.Add("?IpAddress", MySql.Data.MySqlClient.MySqlDbType.VarChar, 15).Value = Request.UserHostAddress;                    Insertcmd.Parameters.Add("?Username", MySql.Data.MySqlClient.MySqlDbType.VarChar, 255).Value = UserName;                    Insertcmd.Parameters.Add("?PKID", MySql.Data.MySqlClient.MySqlDbType.VarChar, 255).Value = userId;                    Insertcmd.Connection = conn;                    conn.Open();                    Insertcmd.ExecuteNonQuery();                    conn.Close();                }                else                {                    MySql.Data.MySqlClient.MySqlCommand Updatecmd = new MySql.Data.MySqlClient.MySqlCommand(                        "UPDATE tracker SET IpAddress = ?IpAddress, IsOnline = '1' WHERE UserName = ?Username AND PKID = ?PKID");                    Updatecmd.Parameters.Add("?IpAddress", MySql.Data.MySqlClient.MySqlDbType.VarChar, 15).Value = Request.UserHostAddress;                    Updatecmd.Parameters.Add("?Username", MySql.Data.MySqlClient.MySqlDbType.VarChar, 255).Value = UserName;                    Updatecmd.Parameters.Add("?PKID", MySql.Data.MySqlClient.MySqlDbType.VarChar, 255).Value = userId;                    Updatecmd.Connection = conn;                    conn.Open();                    Updatecmd.ExecuteNonQuery();                    conn.Close();                }            }        }    } Can anyone advise me on what I should be doing (even if its just a "you should be using this command) if this is not correct? In fact any pointers would be nice !Thanks everyone! 

View 1 Replies View Related

How To Add ControlParameter To SqlDataSource At Runtime?

Dec 8, 2006

Hi!
My question is exactly the subject.
My Web Form has only a GridView and a DetailsView, there is no SqlDataSource at project time, i create the SqlDataSource at runtime using code like this in the Page_Load event: (I NEED IT TO BE CREATED DYNAMICALLY)1 Dim SQLDS As SqlDataSource = New SqlDataSource()
2
3 SQLDS.ID = "CustomerDataSource"
4 SQLDS.ConnectionString = ConfigurationManager.ConnectionStrings("connectionstring").ConnectionString
5 SQLDS.SelectCommand = "select customerid,companyname,contactname,country from customers"
6 SQLDS.InsertCommand = "insert into customers(customerid,companyname,contactname,country) values(@customerid,@companyname,@contactname,@country)"
7 SQLDS.UpdateCommand = "update customers set companyname=@companyname,contactname=@contactname,country=@country where customerid=@customerid"
8 SQLDS.DeleteCommand = "delete from customers where customerid=@customerid"
9
10 SQLDS.UpdateParameters.Add(New Parameter("companyname"))
11 SQLDS.UpdateParameters.Add(New Parameter("contactname"))
12 SQLDS.UpdateParameters.Add(New Parameter("country"))
13 SQLDS.UpdateParameters.Add(New Parameter("customerid"))
14
15 Page.Controls.Add(SQLDS)
16
17 If Not Page.IsPostBack Then
18 GridView1.DataKeyNames = New String() {"customerid"}
19 GridView1.DataSourceID = SQLDS.ID
20
21 ' ... and so on
The DetailsView1 uses the same SqlDataSource to show data, but i could not find a way to synchronize the DetailsView1 with the GridView1 when a record is selected in the GridView1.How can I synchronize the DetailsView?I played with the ControlParameter but i can't find either how to add a ControlParameter in code, is there a way? Every place talking about ControlParameter shows something like this: 1 <asp:SqlDataSource ID="SqlDataSource1" runat="server"
2 ConnectionString="<%$ ConnectionStrings:Pubs %>"
3 SelectCommand="SELECT [au_id], [au_lname], [au_fname], [state] FROM [authors] WHERE [state] = @state">
4 <SelectParameters>
5 <asp:ControlParameter Name="state" ControlID="DropDownList1" PropertyName="SelectedValue" />
6 </SelectParameters>
7 </asp:SqlDataSource>
8
 Ok. OK. But my SqlDataSource is created dynamically. Any ideas on how to solve this problem?Thanks!

View 3 Replies View Related

Set ControlParameter To Todays Date (vb)

Dec 21, 2006

Hi,I have the following sqldatasource on my page:<asp:SqlDataSource ID="rs1" runat="server" ConnectionString="<%$ ConnectionStrings:FrogConnectionString %>" SelectCommand="Proposals_DaySheet" SelectCommandType="StoredProcedure"><SelectParameters><asp:ControlParameter ControlID="Calendar1" Name="FilterDate" PropertyName="SelectedDate" Type="DateTime" DefaultValue=""/></SelectParameters></asp:SqlDataSource>How do I set the default value to today's date ?I have tried:DefaultValue="<%# DateTime.Now %>"But I get:Databinding expressions are only supported on objects that have a DataBinding event. System.Web.UI.WebControls.ControlParameter does not have a DataBinding event.I have also tried:DefaultValue="<%= DateTime.Now %>"But I get:System.FormatException: String was not recognized as a valid DateTime.Any ideas ?ThanksJames
 

View 4 Replies View Related

How To Specify 2 Different Selectparameters - 1 For Querystringparameter And 1 For Controlparameter

Apr 4, 2007

Hello,
I am sure there is a way to do this programmatically, but it is just not sinking in yet on how to go about this.  I have a page where I use a dropdownlist that goes into a gridview and then the selected item of the gridview into the detailsview (typical explain seen online).  So, when selecting from the dropdownlist, the gridview uses a controlparameter for the selectparameter to display the appropriate data in the gridview (and so on for the detailslist). 
My question is - I wanted to use this same page when coming in from a different page that would utilize querystring.  So, the parameter in the querystring would be for what to filter on in the gridview, so the dropdownlist (and that associated controlparameter) should be ignored.
Any suggestions on how to go about this?  I assume there is some check of some sort I should in the code (like if querystring is present, use this querystringparameter, else use the controlparameter), but I am not sure exactly what I should check for and how to set up these parameters programmatically.
 Thanks,
Jennifer

View 5 Replies View Related

SqlDataSource+ControlParameter+Textbox

Jan 15, 2008

Hi!
I have a page (a search page) with sqldatasource, gridview and set of textboxes. The sqldatasource is using stored procedure with parameters. Using the visual wizard i'm associating the parameters with apropriate textboxes controls. It all works, like a charm.
The problem arises when I input some dangerous code in any textbox , like ' or % .
I'm having exception about unenclosed strings, generally info about the possibility of sql injection.
I thought that using ControlParameters, any Parameter in fact is sqlinjection safe, but apparently it isn't.
Does anyone know the right way of achieving my goal? It's very urgent.

View 7 Replies View Related

ControlParameter And Stored Procedures

Apr 2, 2006

I'm sure I'm missing something silly.  I have 3 textboxes, a stored procedure and a gridview.  The user will put something in the 3 boxes, click submit, and see a grid with stuff (I hope).  However, the grid will only return data is I EXCLUDE the controlparameters and only use the sessionparameter.  It's like the stored proc won't even fire!
HTML:
<form id="form1" runat="server"><div>Lastname:&nbsp;<asp:textbox id="Lastname" runat="server"></asp:textbox>Hobbies:&nbsp;<asp:textbox id="Hobbies" runat="server"></asp:textbox><br />Profession:&nbsp;<asp:textbox id="Profession" runat="server"></asp:textbox><asp:button id="Button1" runat="server" text="Button" /><br /><asp:gridview skinid="DataGrid" id="GridView1" runat="server" allowpaging="True" allowsorting="True" autogeneratecolumns="False" datasourceid="SqlDataSource1"><columns><asp:boundfield datafield="Username" headertext="Username" sortexpression="Username" /><asp:boundfield datafield="Lastname" headertext="Lastname" sortexpression="Lastname" /><asp:boundfield datafield="Firstname" headertext="Firstname" sortexpression="Firstname" /></columns></asp:gridview>
<asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:HOAConnectionString %>"selectcommand="spAddressBookSelect" selectcommandtype="StoredProcedure"><selectparameters><asp:sessionparameter defaultvalue="0" name="CommunityID" sessionfield="CommunityID" type="Int32" /><asp:controlparameter controlid="Lastname" name="Lastname" propertyname="Text" type="String" /><asp:controlparameter controlid="Profession" name="Profession" propertyname="Text" type="String" /><asp:controlparameter controlid="Hobbies" name="Hobbies" propertyname="Text" type="String" /></selectparameters></asp:sqldatasource>
</div>
</form>
sp signature:ALTER PROCEDURE [dbo].[spAddressBookSelect] @CommunityID int = 0,@Lastname varchar(200) = NULL,@Profession varchar(200) = NULL,@Hobbies varchar(200) = NULL

View 2 Replies View Related

How To Progtammatically Manipulate Property 'Name' Of ControlParameter?

Jun 7, 2007

Hi,
i want to programmatically manipulate the property 'Name' of a ControlParameter inside a InsertParameters tag.
This the aspx code: ------------------  <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<% ......... %>"         InsertCommand="INSERT INTO .......)"            <InsertParameters>            <asp:ControlParameter Name="myname" ControlID="na" PropertyName="text" />           </InsertParameters>         </asp:SqlDataSource>
code-behind: ------------
Dim a As String         a = SqlDataSource1.InsertParameters.Item(0).ToString
but 'm stuck here
Thanks for help
Tartuffe

View 1 Replies View Related

Load ControlParameter From Page's Peoperties

Feb 25, 2008

Hi,in aspx I've SqlDataSource, in SelectParametersI can add ControlParameter and to load parametersfrom control Property, BUT I'm trying to do that:Is there way, when in <ControlParameter>to set parameter to be loaded from PAGE Property.something like that:aspx:<asp:SqlDataSource ID="_companyDS" runat="server"   ConnectionString="<%$ ConnectionStrings:tihomir_dbConnectionString %>"   SelectCommand="SELECT [companyID], [companyName], [companyInfo], [companyAddress] FROM [Companies] WHERE ([companyID] = @companyID)">   <SelectParameters>     <asp:ControlParameter ControlID="Page" PropertyName="CompanyIdent" Name="companyID" Type="Int32" DefaultValue="0" />   </SelectParameters>    </asp:SqlDataSource></asp:SqlDataSource>code behind:public partial class test : System.Web.UI.Page{   public int CompanyIdent   {      get      {         return ... some id ...;      }   }}  Best Regards,Tihomir Ivanov Best Manager Software

View 2 Replies View Related

Transact SQL :: Converting From Multiple Rows With Single Values To Single Rows With Multiple Values

May 10, 2015

Here is some data that will explain what I want to do:

Input Data:
Part ColorCode
A100 123
A100 456
A100 789
B100 456
C100 123
C100 456

Output Data:
Part ColorCode
A100 123;456;789
B100 456
C100 123;456

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved