Strings Pulled From A Database ?
Jun 18, 2010
Strings pulled from a database formatting issues:
These are pulled from fields in a Database and the results are listed below.
This:recognized as a "Woman in Science" at
Turns into this:recognized as a “Woman in Science†at
This:recently received 2 NIH Director's Awards
Turns into this:recently received 2 NIH Director’s Awards
This:- Director of Communications at acme Communications, Inc
Turns into this:†Director of Communications at acme Communications, Inc.
note:This seems to be not happen when using <ul>
<li> but when it is just enclosed in a <div></div> it
shows the †instead of bullet.How can I fix the display of these strings? This is using C# as the language.
View 7 Replies
Similar Messages:
Jan 13, 2010
I am using a handler to pull an image from the database and I need to resize the image while maintaining the aspect ratio.I have seen a few examples, but they were all pulling the image from the filesystem and not a database. This is the code I am using inside the handler to pull the image from the database:
[Code]....
Can someone point me in the right direction?
View 10 Replies
Apr 2, 2010
Using MVC 2 and VS 2010 RC.I have a varchar database column set to NOT NULL and I use the Entity Framework to bind the column to a textbox. I want a user to be able to leave the textbox blank and have an empty string inserted into the database column. However, MVC is trying to set the property to null during the Create postback, which causes ModelState.IsValid to be false and subsequently the validation UI is triggered with the message "The value '' is invalid".Here is the model:
[Code]....
The controller:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(Candidate c )
{
if (ModelState.IsValid) // This is false when the textbox is left blank.
[code]...
View 3 Replies
Dec 8, 2010
I have a database table that contains list of all UserTypes(constant strings) used in the application.
What is the best way to store(what datastructure do I need) these so that code can access them ?
The need is similar to enum, but I want to associate these values to those in DB so that there will not be 2 places to edit in case of adding/removing an entry.
one other option I considered is using public static readonly string, but how to associate with those values in DB ?
View 3 Replies
Sep 20, 2010
I am trying to convert some strings fetched from database into 'Title case' however it is not working for records like 'JAMES Smith'. The output is all the same.
TextInfo companyName = new CultureInfo("en-US", false).TextInfo;
if(!myRecord.IsDBNull(myRecord.GetOrdinal("GENCLIENTNAME")))
{
myCompany.GenClientName =companyName.ToTitleCase(myRecord.GetString(myRecord.GetOrdinal("GENCLIENTNAME")));
}
View 2 Replies
Jun 8, 2010
I have a website that goes out to multiple clients. Sometimes a client will insist on minor changes. For reasons beyond my control, I have to comply no matter how minor the request. Usually this isn't a problem, I would just create a client specific version of the user control or page and overwrite the default one during build time or make a configuration setting to handle it.
Now that I am localizing the site, I'm curious about the best way to go about making minor wording changes.
Lets say I have a resource file called Resources.resx that has 300 resources in it. It has a resource called Continue. English value is "Continue", the French value is "Continuez".
Now one client, for whatever reason, wants it to say "Next" and "Après" and the others want to keep it the same. What is the best way to accomodate a request like this? (This is just a simple example).
The only two ways I can think of is to
Create another Resources.resx specific to the client, and replace the .dll during build time. Since I'd be completely replacing the dll, the new resource file would have to contain all 300 strings. The obvious problem being that I now have 2 resource files, each with 300 strings to maintain. Create a custom user control/page and change it to use a custom resource file. e.g. SignIn.ascx would be replaced during the build and it would pull its resources from ClientName.resx instead of Resources.resx.
Are there any other things I could try? Is there any way to change it so that the application will always look in a ClientResources.resx file for the overridden values before actually look at the specified resource file?
View 2 Replies
Mar 2, 2011
I am trying to track members volunteering. I have a table that has all our members information and another table I want to update what they volunteer for throughout the year. I have a ddl that they select a last name and it populates first name, last name and spouse in a formview. This all works. There are a couple of other textboxes that need to be filled out. When I try and run an update into the volunteer table I get no errors and page shows the meber was updated. However, when I go into the volunteer table, there is no data.
[Code]....
I don't understand why it is not updating into the table. Especially since I am getting no errors.
View 2 Replies
Mar 23, 2010
On UI Ajax calendar control is used to allow the user Expiry Date as shown below. As this is one of the controls in search, when the Search button is pressed using SQL statement (copied below) data is retrieved from ExpiryDate column of the table. The table creator declared the column type as string and the dates are saved as single digits(Example: 2/2/10 sometimes and sometime as double digits (Example: 02/02/10) I like to know the best practice in retrieving both type of strings from database table. Calendar control
[Code]....
SQL(part of stored proc)
[Code]....
with in button click event stored procedure is called to return search results.
View 7 Replies
May 17, 2010
I have a form that has dropdown box and user can either select Store Associate or Store Manager, when they click on either, I have GetASsociate function that pulls data from sql database. What i am trying to figure out how to do, is that if they say select Store Manager I want to filter what data to pull from that sql table that has all associates in it, so I was trying use an 'expression' statement to stay if Store Manager was selected, only pull me back the store managers from that table. Then same thing for if they selected STore Assoicate, then only bring me back teh store assocites from that table. But the expression statment does not appear to be working.
asxc.vb code behind
Private
Sub GetDataAssociates()Dim provider
As DbDataProvider' Create a collection of parameters.
Dim coll
As
New DbParameterCollection()
Dim prmCompany
As
New DbParameter
provider = DbDataProviderFactory.GetProvider(DataAccessLayer.Enumerations.ProviderType.SqlClient,
"GetAssociatesByCompany")
prmCompany.ParameterName = "@Company"
prmCompany.DbType = DbType.Int32
Select
Case ddlCompany.SelectedItem.Text.ToStringCase
"Stores"
prmCompany.Value = 100
Case
"Corporate"
prmCompany.Value = 300
Case
"Executives"
prmCompany.Value = 900
Case
"Union"
prmCompany.Value = 200
Case
Else
prmCompany.Value = 0
End
Select
coll.Add(prmCompany.ParameterName, prmCompany)
Select
Case
Me.ddlOrganisationStructure.SelectedValue.Trim
Case
"StoreManagers"
Dim expression
As
String
expression =
"Pos_Group >'0900'"
dsAssociates.Merge(provider.GetData(coll).Tables(0).Select(expression)) --IS ERRORING OUT ON ME HERE AT THIS LINE
dsAssociates.Merge(provider.GetData(coll))
dtAssociates = dsAssociates.Tables(0)
Case
"StoreAssociates"
Dim expression
As
String
expression =
"pos_group < '0900'
dsAssociates.Merge(provider.GetData(coll).Tables(0).Select(expression)) -IS ERRORING OUT ON ME HERE AT THIS LINE
dtAssociates = dsAssociates.Tables(0)
End
Select
View 4 Replies
Sep 13, 2010
Making a sales,cost table equal for one year
select all sales from dbo where year = 2008
select all costs from dbo where year = 2008
but now i want to put beside this table
select all sales from dbo where year = 2009
select all costs from dbo where year = 2009
How can i achieve this in one table?
View 8 Replies
Sep 3, 2010
I have a custom class that pulls user information from a SQL Server table. Now that I'm expanding the site from a single page to others. I want to shift the code to the Session_Start event so that the information is always loaded when the site is accessed. How do I call my custom code from global.asax since its script and not a class.
View 5 Replies
May 11, 2010
I want to compare the strings. Its about Disambiguate Doctors profile... If there are four or five members having same name i have to check whether they are same person or not ... If i have smith for five times in my table then i have to check all the five persons like,by having their lastname as comman. check attached form.
Attached Files String Compare1.zip (2.4 KB, 4 views) ThatThatGuy EB Join Date: Jul 2009 Location: INDIA (MUMBAI)
Posts: 424
#2:
May 11 '10
re: How to Compare Strings
String.Equals() will check for same string
View 2 Replies
Aug 26, 2010
I need to post an xml string to another website. I can't create an xml file, because some of the content is dynamically created. The two lines that are causing me problems are
sPostData = sPostData & "<?xml version='1.0'?>"
sPostData = sPostData & "<?qbmsxml version='4.1'?>"
The receiving site expects to see
<?xml version="1.0"?>
<?qbmsxml version="4.1"?>
not
<?xml version='1.0'?>
<?qbmsxml version='4.1'?>
The conversion from double quotes to single quotes isn't being accepted. So how can I send the string so that the versions are surrounded by double quotes?
View 1 Replies
Dec 24, 2010
I have an assembly called like X.Common.DLL. There is some resources files for multilanguage app. Let's say it Language.resx Language.en-US.resx....etc.... I have a web application which contains this above dll as reference... So how can I use this resources file in my web applications markup side?
Text="<%$ Resources:Class, ResourceKey %>" is not valid because of "Class" name is in another assembly...
View 2 Replies
Jan 4, 2010
What is the difference between strings and string builder in asp.net?
View 3 Replies
May 5, 2010
i want to ask one question can we store strings in enumerator?
View 5 Replies
Nov 9, 2010
I'm just getting started using Resharper with VS-2008, and one of the 'errors' it gave me was to localize a Label's text in the code-behind. I've worked with Localization before to Localize a website from english into french, but I don't understand what the benefit is to localizing beside that usage.
View 2 Replies
Jul 25, 2010
I can get the current value of a URL query string by using Request.QueryString["UrlKey"], but can I actually modify the URL with code, without doing a form GET submission?
If the user is landing on the page for the first time, what is the easiest way to programmatically create the ?UrlKey=value through the Page_load method? Or am I better of doing this with Javascript or building a redirect Like: string redirect = "www.mysite.com?" + MyKey + "=" + MyValue;
View 2 Replies
Jun 24, 2010
i have an entir web page stored in a string variable.I would like to remove all the text between the <head> and </head> tags.How would I do this??
View 2 Replies
Jan 12, 2010
I want to check if two string are of the same length. I tried the following, but it doesn't work.
string passnew = "1233";
string passcnfrm = "1234";
if((passnew.Length&&passcnfrm.Length)>6 ||(passnew.Length&&passcnfrm.Length)<15)
{
// ...
}
Why does it not work? What do I need to change?
View 6 Replies
Feb 23, 2010
when to use what type of conversion? For example when writing a class that would update a record I never know when to use
1. Convert.To...
2. int.Parce(...)
3. (int)....
What is the difference?, when would you use which?
SQL = " UPDATE Search WITH (ROWLOCK) SET "
+ " Keyword = " + (string) OR (Convert.ToString) (Keyword)
+ ",PageRank = " + [code]....
View 3 Replies
May 28, 2015
So, I've got an array, filled with data from dynamic input fields. the input fields are PIN, Name and Description... and the user can add as many "sets" of these three fields as they want.
This data goes into an array.
For example, the array may have
11111, Test Name, Test Company
22222, Second Name, Second Company
etc. etc.
I know I can see the values of my array, so if I were to take:
item(0) & ", " & item(1) & ", " & item(2)
my output would be:
11111, Test Name, Test Company
The problem I'm having, is, I need to write ALL of the groupings of three out to a file... and I'm stuck on how to do that. So, I need a way to loop through until the end of the array and get:
item(0) & ", " & item(1) & ", " & item(2)
(enter a line break)
item(3) & ", " & item(4) & ", " & item(5)
...
until the end of the array
I'm guessing I need a for-loop and a counter, but can't get the syntax correct.
View 1 Replies
Jul 15, 2010
I'm new to .NET and converting and proper way to convert strings to other values. Specifically, here is a situation I'm facing:
I'm returning two values from a datasource as strings. One values is a representation of a span of time, and another is a count of how many attempts to access a system took place within the span of time.
Given these parameters (for example):
Span of time: 00:01:00
Attempts: 13
I'd like to calculate a third value that shows how many seconds each attempt to connect took place during that span of time. This involves converting the time span to seconds and then dividing by attempts. Where I am getting lost is with the conversion of types. I know the span of time needs to be converted to a date, reduced to seconds, then converted to a number to be divided by the attempts field, also converted to a number.
I've been playing around with code segments like this all morning to no avail:
VBNET Code:
Dim thisTime As String = "00:01:00"
Dim thisAttempts As String = "13"
Label1.Text = thisTime
Label2.Text = thisAttempts
Label3.Text = Math.Round(Integer.Parse(Convert.ToDateTime(Label1.Text)) / Integer.Parse(Label2.Text), 2)
View 2 Replies
May 31, 2010
What is the best practice for encrypting the connectionStrings section in the web.config file when using LINQ TO SQL?
View 2 Replies
Dec 25, 2010
i want define connectionSreing in the web.config and then use it for DataContext ConnectionString. i do that : 1. i creat a class in App_Code :(MisaghDB is my database)
partial class MisaghDataContext
{
partial void OnCreated()
{
this.Connection.ConnectionString =
ConfigurationManager.ConnectionStrings["MisaghDBConnectionString"].ConnectionString;
}
// or
public partial class MisaghDataContext
{
public MisaghDataContext() : base (ConfigurationManager.ConnectionStrings["MisaghDBConnectionString"].ConnectionString)
{
OnCreated();
}
}
}
2. Add the connection string to my web.config file:
<configuration>
<connectionStrings>
<add name="MisaghDBConnectionString" connectionString="Data Source=NAZLIN-HP;Initial Catalog=MisaghDB;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
3. Right click on the DBML file design surface and chose properties. Select "none" for the Connection property.now should i change DBML file designer.cs (Misagh.designer.cs) ? The code should I delete in this file(DBMLfile designer.cs)? this is a part of my DBMLfile designer.cs :
[global::System.Data.Linq.Mapping.DatabaseAttribute(Name="MisaghDB")]
public partial class MisaghDataContext : System.Data.Linq.DataContext
{
private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
public NorthwindDataContext() :
base(global::WindowsFormsApplication2.Properties.Settings.Default.NorthwindConnectionString, mappingSource)
{
OnCreated();
}
public NorthwindDataContext(string connection) :
base(connection, mappingSource)
{
OnCreated();
}
public NorthwindDataContext(System.Data.IDbConnection connection) :
base(connection, mappingSource)
{
OnCreated();
}
public NorthwindDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
public NorthwindDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
............}
View 4 Replies