Difference Between Strings And Builder?
Jan 4, 2010What is the difference between strings and string builder in asp.net?
View 3 RepliesWhat is the difference between strings and string builder in asp.net?
View 3 Replieswhat string builder command do in the asp.net cs file.
View 4 RepliesI am using the code below (simplified for this example) to post data to a SharePoint list
StringBuilder customerDoc = new StringBuilder();
customerDoc.Append("<Method ID='1' Cmd='New'>");
customerDoc.Append("<Field Name='Name'>" + Name + "</Field>");
customerDoc.Append("<Field Name='Age'>" + age + "</Field>");
customerDoc.Append("<Field Name='City'>" + city + "</Field>");
customerDoc.Append("<Field Name='Country'>" + country + "</Field>");
customerDoc.Append("</Method>");
XmlDocument xDoc = new XmlDocument();
XmlElement xBatch = xDoc.CreateElement("Batch");
xBatch.SetAttribute("OnError", "Continue");
xBatch.InnerXml = sb_method.ToString();
XmlNode xn_return = sharePoint.listsObj.UpdateListItems(ConfigurationManager.AppSettings["SaveCustomer"].ToString(), xBatch);
As you can see I am using a stringbuilder which isn't ideal so I wonder what I should use instead to create an XML string?
SqlDataReader myreader;
myreader = cmmd.ExecuteReader();
StringBuilder sb = new StringBuilder();
sb.Append("<b>Vaccine</b> <b> Vaccination Date</b> <b> Vaccination Due Date</b> <b> Incomplete Vaccination </b> <b>Dose No.</b> <b> Remarks </b><br/><br/>");
while (myreader.Read())
{
sb.Append(myreader["VaccineID"]);
sb.Append(" ");
sb.Append(myreader["DateOFVaccine"]);
sb.Append(" ");
sb.Append(myreader["NextVaccinationDueDate"]);
sb.Append(" ");
sb.Append(myreader["AnyIncompleteImmunization"]);
sb.Append(" ");
sb.Append(myreader["DoseNumber"]);
sb.Append(" ");
sb.Append(myreader["Remark1"]);
sb.Append("<br/>");
}
lblDisplayDetails.Text = sb.ToString();
myreader.Close();
WHAT EXACTLY I WANT IS TO RETRIEVE DATA(may be from separate table) AND THEN DISPLAY THEM PUTTING SOME STYLE(font,color etc). Is retrieving from multiple table is possible in gridview ? I could use the DataReader, but how to display them in style(font,color etc)?
I am using LINQ to SQL in my application. I have some fields like textbox and checkbox in my form. when i enter any text in textbox it should search the data in the database. it should display in some control. Here i want to write query in LINQ I want to use predicate builder. If we are using sql server we have to write in stored procedure but i dont want in stored procedure. plz tell how to use predicate builder and explaination.
View 1 RepliesI have written such a code to loop through the records and build a string.
Is this s good idea or should I use repeater or something?
[code]....
report builder row filtering?
View 3 Repliescan i add string builder object to a dictionary object? If yes code it. I mean i have a dictionary in which i have already added a few (string, objects), and i have a string Builder which has few variable already added now i want that instead of passing 2 different object in a method i want to pass only one object so can i add string builder object to same method as well
View 2 RepliesI have the following HtmlHelper method that I want to create a button that does a redirect with JavaScript:
public static string JavaScriptButton(this HtmlHelper helper, string value,
string action, string controller, object routeValues = null, object htmlAttributes = null)
{
var a = (new UrlHelper(helper.ViewContext.RequestContext))
.Action(action, controller, routeValues);
var builder = new TagBuilder("input");
builder.Attributes.Add("type", "submit");
builder.Attributes.Add("value", value);
builder.Attributes.Add("class", "button");
builder.Attributes.Add("onclick", string.Format("javascript:location.href='{0}'", a));
builder.MergeAttributes(new RouteValueDictionary(htmlAttributes));
return MvcHtmlString.Create(builder.ToString(TagRenderMode.SelfClosing)).ToString();
}
The problem is that the line that creates the onclick handler is getting escaped by the tagbuilder, the resulting html is: <input class="button" onclick="javascript:location.href=''" type="submit" value="Return to All Audits" />
I'm new to Borland C++ Builder and the application that I'm working on has to be launched from a ASP.net application on click of a button. That ASP.net application is able to launch other EXEs (made in C#) but when my application is launched it crashes immediately with a msg "an error has is encountered, tell microsoft about this problem" with button "Don't Send" "Send error report" and "debug". The ASP.net program is able to call "notepad.exe" which is probably not written on .net.
So, how do I call an application from ASP.net/c# which written in Borland C++ Builder and is launching successfully when I double click the application.
string url = "~/sales/saleimage/RedErrorImage.png";
StringBuilder b = new StringBuilder();
b.Append("<img src=");
b.Append(url);
b.Append("alt='No Image Available' width='350px' height='200px' >");
Image not Displaying where m i wrong
I am having doubt in whether to use string or string builder to append html elements like "div" and others in my page in mvc. Is there any other approach for this thing.
View 7 RepliesStringBuilder displayList = new StringBuilder();
I have added a few items in displayList but in my code i need to search for an item in displayList how can i search an item added to displayList.
i am using stringbuilder but i have hit a problem. the line below
sb.AppendLine("ctl00_ContentPlaceHolder1_rptNav_ctl00_AssetsTreeControl_1_pnlAssetsContext");
i need this to be passed as a string value ie
ctl00_ContentPlaceHolder1_rptNav_ctl00_AssetsTreeControl_1_pnlAssetsContext
'ctl00_ContentPlaceHolder1_rptNav_ctl00_AssetsTreeControl_1_pnlAssetsContext'
the problem is if i do this i get a js error of
Error: syntax error
Source Code:
return ShowContextMenu(event,
StringBuilder sb = new StringBuilder();
sb.AppendLine("<b Id='");
sb.AppendLine(assets_item.Id.ToString());
sb.AppendLine("' oncontextmenu='return ShowContextMenu(event, ");
sb.AppendLine("ctl00_ContentPlaceHolder1_rptNav_ctl00_AssetsTreeControl_1_pnlAssetsContext");
sb.AppendLine(")'>");
sb.AppendLine(assets_item.Title);
sb.AppendLine("</b>");
i am planning to user command buider.
but i get unique key violation i have set the primarykey both in data tabble and database and here is my code
what is wrong here?
[Code]....
i just cant install VWD2008.But heres the thing, i have had it installed before along side VWD2010 about a 5 weeks ago.After download everything is ticked and says ok, after i exit, it cant be found, its really starting to drive me nuts and take my life over
View 3 RepliesI need to create a form builder without using any of the third party tools. i.e a user shold be able to pick his choice of textbox, dropdown ..etc and create a form.
View 1 RepliesI am working on building a custom form builder module for our customers ... and wondering if you know any good .NET code base references for this module.
Requirements:
Customer should be able to add a form field(radio button, text box, dropdown menu) and customize the values real time.
I keep getting a Request format is invalid.
Here's the raw http that get's sent:
[code]....
Code:
SqlDataAdapter da = new SqlDataAdapter("select * from " + txtTableName.Text, DataStoreGeneral.GetConnectionString());
DataTable dt_app = new DataTable();
da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
da.FillSchema(dt_app, SchemaType.Source);
da.Fill(dt_app);
SqlCommandBuilder build = new SqlCommandBuilder(da);
da.InsertCommand= build.GetUpdateCommand();
da.Update(ds.Tables[1].GetChanges(DataRowState.Added));
Problem: In my scenerio i had dataset with a table (in code->ds.Tables[1]) in rowstate added. I wanted update on database with this table so i changed insert command of adapter to update command of command builder, but no update got performed. When debugged in sql profiler i found that update command generated by builder is checking all columns in where clause and with parameter value of data table instead of from database column value.
exec sp_executesql N'UPDATE [ShopResources] SET [GROUP_RESOURCE_ID] = @p1, [SEQ_NO] = @p2, [SUB_RESOURCE_ID] = @p3, [EFFICIENCY_FACTOR] = @p4, [RUN_COST_PER_HR] = @p5, [RUN_COST_PER_UNIT] = @p6, [BUR_PER_HR_SETUP] = @p7, [BUR_PER_HR_RUN] = @p8, [BUR_PERCENT_SETUP]
= @p9, [BUR_PERCENT_RUN] = @p10, [BUR_PER_OPERATION] = @p11 WHERE (([GROUP_RESOURCE_ID] = @p12) AND ([SEQ_NO] = @p13) AND ([SUB_RESOURCE_ID] = @p14) AND ((@p15 = 1 AND [EFFICIENCY_FACTOR] IS NULL) OR ([EFFICIENCY_FACTOR] = @p16)) AND ([RUN_COST_PER_HR] = @p17)
AND ([RUN_COST_PER_UNIT] = @p18) AND ([BUR_PER_HR_SETUP] = @p19)
The problem I identified is parameter values inside where clause are from data table which is obvious that update condition will not be met. Is there some way to restrict where clause to primary key only in Command Builder?Or why is command builder taking where clause parameter values from datatable instead of command (query)?
I want to develop reporting service application in asp.net 2.0 with SQL server 2005.
I install sql server 2005 in my remote machine with BIDS. I need to develop reporting service application in my machine i have vs 2005 and sql server express edition.
How to download/install BIDS or Report Builder for vs 2005 in my machine.
i currently working on a webform. My current codes are below:
[Code]....
1. first of all i would just like to have 1 XML file that will contain both the builder and manager email address. I tried the following code but it does not work. Basically i set the databinding source for both the dropdownlist to the same source with different datafield value(for builder) and name(for manager).
[Code]....
2. So i want it to set so that when users select "Others" as an option, they are allowed to enter new email address manually. And i want them to update this XML file so that the next time they access this form they would be able to see the previous email entry that they provided.3. How do i get the 2 panels side by side at the bottom? For example i would like them to see the Label next to the Textbox.4. Last question, how do i create a text in the label so that i can see the Version when they press update in the form. For example if the major version is 6, user enters 6 and press the update button and the "Major Version" would display something like "Major Version = 6"?
When i create a sql script in the Query Builder (going through the wizard in a DataSet) the Query Builder window is to small for me. Is there a way to maximize this window by default?PS, I have previously posted this in the forum "Visual Studio 2008.
View 2 RepliesVisual Web Developer 2010 Express
ASP.Net and C#
My issue is that I am pulled three tables together using the Query Builder and I only want to show data where a specific date is greater than todays date. Here is what i have so far:
[Code]....
Where it says '2010-09-01 00:00:00' I want that to be the todays date.
Is this possible?
I would like to create my reports by drawing out the data from the database.After creating my template (what would be in my report) and saving it as the .rdlc format, what should i do next do preview the actual data, or to present it in my asp.net pages.
I like the way how report builder works as it can export to pdf/excel, however its a standalone. Is there any way to make it similar in microsoft visual studio 2010 professional?