.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan
Santhakumar Munuswamy
Fauzul Azmi
Asad Ali
Post New Web Links

SQL Server Money datatype pushed to SqlDataSource

Posted By:      Posted Date: September 19, 2010    Points: 0   Category :ASP.Net
 

I have a table in my SQL Server db with fields of money datatype.  It seems as though SQL Server likes to have 4 decimal places for the money datatype, but is there any way in the settings of this table or that money field to change this to 2?  I know how to programmitically trim the last two zeros, just wondering if I can manually set something so I don't have to do this every time I retrieve the money datatypes from the database table.

Thanks in advance! :)




View Complete Post


More Related Resource Links

Store Null Data In image datatype in sql server 2005

  

hi

i wanted to store image in sqlserver database image field and i did. But now in some cases i want to store null value in that image field please let me know how to do this using file uploader.please give complete sample code.


regards


Query on XML datatype in SQL Server 2008

  
Hi All, In table I have column with XML datatype. I can able to read the below XML tag. SET   @Title = CAST(@XMLContent.query('data(root/chemicalName)') AS VARCHAR(50)) <root><chemicalName>Sulphuric acid</chemicalName></root> but how can I read (in SQL Server 2008) with multiple rows in it, and how to know the list of child nodes and data of it dynamically? <Root> <Row> < CurrencyCode>GBP</CurrencyCode> < CurrencyName>POUND (STERLING)</CurrencyName> </ Row> <Row> < CurrencyCode>INR</CurrencyCode> < CurrencyName>Rupee</CurrencyName> </ Row></

Insert/Update OLE Attachment(Binary datatype) using SQL server 2000

  
Hi All, In the same senario how we can Insert/Update OLE Attachment(Binary datatype)  from one source table to other destination table by using SQL Server 2000 not with C# fronend code. Appreciated if you can give fix on this regads, Divakar.

Can't connect my VWD express "sqldatasource" control to a SQL Server Express Database

  
Good day Sirs,   As the title is saying, I cant seem to connect to my SQL Server Express Database using "sqldatasource" control in Visual Web Developer 2010 Express Steps Taken: clicked "configure data Source" option in the Sqldatasource then "New Connection..." Changed my Data source: to " Microsoft SQL Server Database File (SqlClient) Here comes the problem: 1. I am choosing a Database file name but a problem keeps on popping:     "ServerName This file is in use: Enter a new name or close the file that's open in another program" 2. Then I tried to choose a detached database file (mdf) and it was attached now another problem pops:    "ServerPath cannot be opened becuase it is version 661. This server supports 655 and earlier.   I am using windows Home Edition: does it contribute to my problem? My server and VWDE is in the same equipment(laptop)   Does anyone have an idea why is it like this? Thanks

dyanamic data and sql server xml datatype

  

it seems that an xml datatype fields simply appears as a textbox when rendered in Dynamic Data (presumably allowing an xml document to be input, viewed etc). however this is of no use to the end user. is there any way (or future intention) to allow rendering of the xml fields uisng a related dtd?

john


Selecting from SQL Server DB 2005 - with SqlDataSource C#

  

I just need to know how to select in c# select from my sql server database for the purpose of seeing if data already exists.. do not need to display the data (i know how to select the data and display it in a data grid) but I am checking to see if dates are already in the database before performing an insert since there can not be duplicate dates... it is late but I only can figure out how to use the data as it applies to viewing or if bound to a control...

Also I am not using the aspx... in tags... my c# is seperate... (am I not making sense? sorry super tired)

do I have to use a stored procedure just to see if the row exists??? any info greatly appreciated...  


GridView: Money-datatype in Edit-Item-Textbox

  

I have several fields in my GridView which are editable by the user (after klicking on "edit") and are displayed in the format XX,XX by default (because of "{0:c}"). The fields are converted to TemplateFields because I added Validators into the GridView.

This fields are read from a sql database where they are defined as the type "money".

My problem is when the user klicks the edit-button the format changes from XX,XX to XX,XXXX so the user is forced to keep this format when he edites the data.

htmlencode="false" and DataFormatString="{0:c}" doesn't work.

<asp:TemplateField HeaderText="Entgelt" SortExpression="Entgelt">
                             <EditItemTemplate>
                                 <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Entgelt") %>'></asp:TextBox>
                                 <asp:CompareValidator ID="CompareValidator1" runat="server" 
                                     ControlToValidat

How to show final SQL from parameterized SQLDataSource before sent to SQL server?

  

I have a SQLDataSource that I'm having a little trouble with. I am using a parameterized FilterExpression and am not getting something right. So, I want to see what the final SELECT output will be that the SQLDataSource is generating and will be sending to the database so I can see what the SQL looks like. How do I do this?

 

Added:
Here is my code so far:

DetailSource.SelectCommand = "SELECT * from Pictures ";
DetailSource.FilterExpression="ParID = '{0}' AND CardNum = '{1}' AND SeqNum = '{2}'";

DetailSource.FilterParameters.Clear();
DetailSource.FilterParameters.Add("ParID", GridView1.SelectedRow.Cells[1].Text);
DetailSource.FilterParameters.Add("CardNum", GridView1.SelectedRow.Cells[2].Text);
DetailSource.FilterParameters.Add("SeqNum", GridView1.SelectedRow.Cells[3].Text);

Response.Write(DetailSource.ToString()); 

 

Thanks! 


Cannot generate table scripts with DateTime2 datatype in SQL Server 2008

  

When trying to generate a "CREATE TO" script from a SQL Server 2008 table containing either DATE or DateTime2 data types,  I get the following error:

Script failed for Table 'dbo.tMyTable'.  (Microsoft.SqlServer.Smo)
Column SnapshotDate in object tMyTable contains type DateTime2, which is not supported in the target server version, SQL Server 2005. (Microsoft.SqlServer.Smo)

However, I've checked all my databases (including master, tempdb, etc.) and ALL are cmptlevel=100.

Thoughts?


ERROR: The version of SQL Server in use does not support datatype 'date'.

  

I receive the subject error when I attempt to update a simple SQL database that I've created in Visual Web Developer 2005 Express Edition.  I also have SQL Server 2005 Express Edition installed.  I'm running XP SP3.

 

The database has one table called Customers with the following 5 fields: CustomerID (int) & primary key, FirstName (varchar(50)), LastName (varchar(50)), CreditLimit (smallmoney) and CustomerSince (smalldatetime).  I've added about a dozen records to the table.

 

I can display the table in the web site and select records.  However, after I add editing and deleting and attempt to update an edited record I receive the subject error which is pasted at the end of this question.  Thinking my installation of SQL Server 2005 was the problem, I uninstalled and reinstalled.  Still got the error.

 

NOTE:  I have created the same database on a virtual machine also running XP SP3 with the Express Edition products mentioned above.  The table updates with no error.

 

So I'm thinking the error message is probably not directly related to a SQL problem but some system problem that is on my host computer but not on my virtural machine.

 

Any ideas?


call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

Making Ajax Callbacks to the Server Using jQuery with ASP.NET

  
In the first part of this article series I introduced jQuery's functionality and how it provides a rich client side programming model. This time around I'll expand on these concepts and show you how you can use jQuery in combination with ASP.NET using it as an AJAX backend to retrieve data. I'll also discuss how you can create ASP.NET controls and otherwise interact with jQuery content from ASP.NET pages in WebForms.


jQuery is just a JavaScript library so it will work seamlessly with ASP.NET both from page code as well as through backend driven code using the Page.ClientScript object or ScriptManager. You can use jQuery on its own as a client side and Ajax library that communicates with ASP.NET or you can use jQuery in combination with ASP.NET AJAX. The two actually complement each other quite well as jQuery provides functionality that the ASP.NET AJAX library does not and vice versa. For the most part the interaction between the two libraries is trouble free except for a few very rare edge cases.

MS SQL Server: Disconnect Users From Database - Kill User Session

  
If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

MS SQL Server: Search All Tables, Columns & Rows For Data or Keyword Query

  
If you need to search your entire database for specific data, this query will come in handy.

So when a client needs a custom report or some sort of custom development using Great Plains, most of the time I will have to track down the data in the system by running this query and find the table(s) it is in.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side

Publishing SQL Server Database using Publishing Wizard : Tips & Tricks

  
We can use SQL Server Publishing Wizard to deploy our local Database to remote hosting server/production server.This feature is available in SQL Server 2008/VWD 2008.

Below is the complete step by step guide of this process.

CLR Integration With Microsoft SQL Server

  
Transact-SQL provides as much flexibility as possible but, because it is not a real programming language, it has some shortcomings about many issues (memory management, exception handling, debugging, file processing (or streaming), object-orientation (classes), or thread management). Transact-SQL also lacks features of normal libraries (arrays, collections, serialization, expressions, or string manipulations, etc).
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend