What function do I use to reduce all entries in a database field to a maximum length. The field is 100 characters wide and I need to chop all existing entries in the field down to 20 characters. I prefer not to redefine the field to 20 wide to lose the data and then redefine back to 100.
UPDATE CmpyInfo
SET ( ShortName to 20 characters max )
WHERE ShortName.Length > 20
I have to set maximum length for bound field in an editable gridview. For this i have used data format string property and also given ApplyFormatInEditMode="true" still it accepts invalid input. The gridview does not have template field, it contains bound fields only. I have written OnRowEditing and RowUpdating events. The dataformat string is DataFormatString="{0:N0}" but it accepts '2352345234523454352345' input also and displays server error while updating in database. I want to spcify maximum length for the textboxes generated dynamically when Edit button is clicked.
I got the overlap text when display data in Crystal Report columns. How do I set how many character to display to prevent the over lap the character to other column in Crystal Report.
I have a SQL Server table with a number of fields that are defined with the "Float" data type. I'm running a simple query to retrieve the data from this table and use it to populate a Data Table in my C#.net application.
I just discovered that the data type of the Data Table fields is Double, not Float as I expected. As such, when I store a value like 0.157 it ends up getting stored like this: 0.15700000524520874
I'm aware that such extra "noise" occurs when such a conversion occurs. My major question has to do with why .Net didn't set the Data Type to Float (ie. Single) when the table was first populated?
I have a string coming from a stored procedure looks like '001234567'.
sqlCommand = new SqlCommand("csp_Bbp_OBN_GetBasePageList", BBConnection); sqlCommand.CommandType = System.Data.CommandType.StoredProcedure; sqlCommand.Connection.Open(); // Run the SQL statement, and then get the returned rows to the DataReader. accReader = sqlCommand.ExecuteReader();............
In my case, from the stored procedure I am returning the varchar, after executing and reading it I am getting the value to basePage.GrouNum which is a string. So, I don't see where it is trimming the leading zeros.
Example: GroupNumber in the table is : "001234567" BasePage.GroupNum after reading from DataReader : "1234567"
But, I do not want the leading zeros being trimmed.
I was wondering if people out there test the length of their text values before inserting them into an SQL INSERT or UPDATE command? I got lazy and stopped doing it lately but I do restrict the length of some of my character fields so that I have a NCHAR(50) field but don't test the length of the string when inserting or updating and just rely on the server to fire back any problems.Am I being 'efficient' or 'lazy' or even 'dangerous'?I appreciate the opinion of you as just about anyone has more experience with SQL Server than I do.
I have my Web site set up to use SQL Server session state. This works fine. When a session starts, a row is created in ASPStateTempSessions.
When the user logs off the application, I am trying to call the stored procedure TempRemoveStateItem to clean up after myself (not sure if this is the right way to do it or not).
What I noticed is that the SQL table's SessionID column contains 32 characters whereas the .NET Session.SessionID value only contains 24 characters (which match the first 24 characters of the 32 characters stored in the SQL table). Because the values do not match, the stored procedure always fails.
Why would the SessionID value differ between .NET and SQL?
I've a string builder, and I need to convert it to a string, and then trim any commas if there are any there (I need to get rid of them because I'm building an sql query).
Here's what I'm doing:
myStringBuilder.ToString().TrimEnd(',');
Why isn't this working??? It's not trimming any commas at the end!
using vb.net/asp.net 2005 and sql server 2005. I'm querying the database and returning text which I am then adding to a string. I'm creating a crystal report with the text however this is not a crystal report question, its about the string data. what I"m noticing is that when I show the string on the pdf that there are some strange characters at the end of the string. I am both trimming the string and taking out null characters however the strange text shows up like this:
strangeText> SÙÇ TÙçy|Ü DÙÇ $ÛÇ </strangeText>
does anyone know what these characters are and how to get rid of them?
The GridView in ASP.NET 2.0 is trimming the leading spaces from data coming from a SQLServer database. I have yet to find a way to keep it from doing that. The data in this particular view is being edited to remove such spaces, but only upon editing the row can any leading spaces be seen, meaning, at present, each row will have to be touched. With 12,000+ rows, that's a little much.
What little I've found on Google has mainly be concerned with trimming leading spaces. Is there a way to force GridView to show the data exactly as it is in the database, leading spaces and all?
I am observing a rather strange behavior. I have a procedure which selects a field from a matching record and returns it. The procedure works as expected returning proper values, when I execute the procedure from Visual Studio Server Explorer tab. The procedure is
[Code]....
This is being called from the DAL as follows:
[Code]....
The problem is if @ReturnValue is EAE then cmd.Parameter[outputParameterKey].Value is giving the value "E". If @ReturnValue is "Sassyboy" it is giving "S". why this behavior?
We're writing an app that has a requirement for allowing/disallowing access based on user role.In a traditional .net app of course you set the security trimming attribute in the web.config and set the nodes in the web.sitemap file and you were set.
In my web.config I have configured a SiteMapProvider with securityTrimmingEnabled="true" and on my main master page is an asp:Menu control bound to an asp:SiteMapDataSource. In addition I have configured restricted access to all pages in a subfolder "Admin" (using another web.config in this subfolder).
... it seems that security trimming does not work: The menu item is visible for all users. (Access to the page is still restricted though, so selecting the menu item by non-Admin users does not navigate to the restricted page.)
Question: Is there any setting I've missed so far to make security trimming working with URL routing in ASP.NET 4.0 Web Forms? Did I do something wrong? Is there any work-around?
When the user tries to upload a file with a size more than 4 MB, the AsyncFileUpload control gives a Confirmation alert (with "OK"/"Cancel" button) with the following message "Server Response error: Maximum Request Lengh Exceeded". But when the User clicks the "OK" button a new window popups and shows the server error and on clicking the cancel button the AsyncFileUpload background color turns red. Here I am not sure why the control is showing a Confirmation alert instead of a simple alert message. Is it possible to change the Confirmation alert with the simple alert message? Basically I don't want the popup window to show the server error as it is happening currently. Also, is there a better way to handle the file size error and show apporiate error message to the users?
I pulled a fast one today. I imported thousands of records and accidentally put the FName in the LName and the LName in the FName. I don't have a clue how to write a SQL or TSQL that will switch them. I do have a parameter for the SQL though. WHERE User - System Import.on ASP.NET because this is my place for help instead of going elsewhere to a more specific type of forum just for SQL. I do only ASP.NET VB/CS development so this is my home to find all my answers. (99% of the time).
I'm trying to delete some data in my database where no data is inside the field name and field id
select freelancer.id, freelancer.name FROM [bewerber].[dbo].[freelancer] WHERE freelancer.id = 'NUll' and freelancer.name = 'NUll' ORDER BY freelancer.vorname
I use a ntext data type for all kind of data save in one field, but when i save byte (that converted from image) follwing message is shown "Operand type clash: varbinary(max) is incompatible with ntext". Is ntext suitable for all kind of data type or what will be compatible for all data type support?