Money Format Error

Oct 10, 2006

I use asp.net 2.0 and sql server 2005 for a web site (and Microsoft enterprise library).When I run aplication at local there is no problem but at the server I take this error:
Disallowed implicit conversion from data type varchar to data type money, table 'dbname.dbo.shopProducts', column 'productPrice'. Use the CONVERT function to run this query.

productPrice coloumn format is money. It was working correctly my old server but now  it crashed.How can I solve this problem? And why it isn't work same configuration?
 
My code:
decimal productPrice;
Database db = DatabaseFactory.CreateDatabase("connection");
string  sqlCommand = "update shopProducts set ......................,productPrice='" + productPrice.ToString().Replace(",", ".") + "',..................... where productID=" + productID + " ";
db.ExecuteNonQuery(CommandType.Text, sqlCommand)

View 1 Replies


ADVERTISEMENT

Money Format ..need Some Help..please

Jan 13, 2007

Hi everybody.Here's my Product tableID int,Title nvarchar(50),Price moneyHow can I get value from price field like thisIF PRICE is 12,000.00 it will display 12,000IF PRICE is 12,234.34 it will display 12,234.34Thanks very much...I am a beginner. Sorry for foolish question

View 7 Replies View Related

Money Format

Oct 10, 2007

 hello everyone...,i have problem in money format...i have moneytable is containning: userid          money   A            20000,0000   B            40000,0000userid type varchar(50)money type money i have store procedure like this:ALTER PROCEDURE [dbo].[paid](    @userid AS varchar(50),    @cost AS money, @message as int="1"  output)ASbegin transactiondeclare @money as money select @money = moneyfrom moneytablewhere userid=@useridif (@money > @cost)beginset @money = @money - @costUPDATE moneytable        SET money = @money        WHERE userid=@useridset @message ='1'endelsebeginset @message = '2' endCOMMIT TRANSACTION when i execute this procedure. i insert value to userid        Acost         100,0000 it can not decrease, because cost 100,0000 is same with 1000000, why is like that?i want cost 100,0000 is same with 100. how can i do that? thx... 

View 6 Replies View Related

Money Format

Apr 5, 2001

Is there a way to format the output of an calculation so that a comma is used as decimal symbaol and a periode after each 3 digits left of the comma ?

We're calculating salary increase like 5000 * 1.025 and the output should look like 5.250,00

Thanks for any help
Charles

View 2 Replies View Related

Money Format

Jun 3, 2008

Hi, I have data in a Payment field:

45.14 - was orig in text format.
Now after converting to money, I see it as this:

45.1400

I need to get rid of the zeros! Anyone please help?

Thanks!

View 3 Replies View Related

Money Format ..need Some Help..please

Jan 12, 2007

Hi everybody.
Here's my Product fields

ID int,
Title nvarchar(50),
Price money

How can I get value from price field like this
IF PRICE is 12,000.00 it will display 12,000
IF PRICE is 12,234.34 it will display 12,234.34

Thanks very much...I am a beginner. Sorry for foolish question

View 4 Replies View Related

Money Data Type Format

Mar 23, 2006

Why does SQL add 4 zeros at the end of a money data type?  I have to format my strings once they are retrieved because of this.  I am not sure if I did something wrong, but shouldn't it only have 2 trailing zero's?

View 1 Replies View Related

Format Money Value As Padded String

Feb 22, 2007

Ok my last formatting question.How can I insert a money value as a padded string in another table?example $1.25 gets inserted to another table as 00000125I want 8 total characters and no decimalanother example would be 4,225.99 becomes 00422599can this be done?thank you!!

View 7 Replies View Related

My Own/Sweden Money Format On A Chart?

Feb 15, 2008

Hello
I have a chart, staple chart, where the Y-axis shoes the revenue in my system. The X-axis shows a period of time. The revenue is shown without any format at all €¦ not good cause when the revenue gets up to 25miljon the user is counting zeros.

What I usually use to format money values:
=Format(Sum(Fields!revenue.Value), "# ### ### ###")
With spaces on the thousands. In Sweden it is usually shown like this.

25million is 25 000 000.

But when I go to the Chart Properties->Data->Values Edit, in this part I have under Value: =Sum(Fields!revenue.Value) €¦ so I thought I could do the same here and put in my =Format(Sum(Fields!revenue.Value), "# ### ### ###") €¦ but no. It didn€™t work. The chart is empty.

What can I do to make the values of the revenue for each month in the format of my choosing? Or even better how can I make the report choose Swedens money format?

Kind Regards
//Javier

View 6 Replies View Related

CCUR Format - Convert To Money Function

Oct 6, 2013

I have the below Ms.Access code that I would to transition into SQL.

Is CCUR a usable function in SQL, or would I have to use the convert to money function?

Charges: Sum(((CCUR([Fee Schedule Rate])*CCUR([Units_Charged]))))

View 1 Replies View Related

Format Money Or Float 2 Decimal Places

Mar 24, 2008

How do I format the money or float field types to 2 decimal places during a SELECT statement?

View 4 Replies View Related

Data Access :: 2008 R2 - Format All Money Types

Aug 13, 2015

I've got several columns in my database stored as money type.  For my purposes, when reporting this data I need to truncate trailing zeros after the decimal.  I know I can create a function to do this.  I think given the quantity of columns and the numerous queries accessing them, I will undoubtedly forget to use a function everywhere needed.

I thought user defined types may be a solution. I've never used them before. I would still like to store the data as a money type, but anytime it is accessed it would be formatted. Can user defined types do this, or is there a better way?

View 18 Replies View Related

Format Money MS SQL Field Data As Number With Commas And No Decimals

Mar 20, 2006

If I pull a value from a MSSQL field with is defined as money, how can I get it to display in a textbox with commas and NO decimals?
87000.0000 = 87,000
I can currently remove the decimals like below but is there a way to add the commas as well?
decRevenue = drMyData("Revenue")
txtRevenue.Text = decRevenue.ToString("f0")
It current shows "87000".
 
 

View 1 Replies View Related

How Can I Cast A Money Field In A View To Look Like Money

Oct 16, 2007

I have a special need in a view for a money column to look like money and still be a money datatype. So I need it to look like $100.00 (prefered) or 100.00(can make work).
If I convert like this '$' + CONVERT (NVARCHAR(12), dbo.tblpayments.Amount, 1) it is now a nvarchar and will not work for me.
How can I cast so it is still money? by default the entries look like 100.0000.
They must remain a money datatype.

View 9 Replies View Related

Inserting More Then 999.99 In Money Field Error

Feb 21, 2007

I am trying to insert 1000000.00 into my sql table from a webpage.  I as long as the amount is 999.99 or less it works fine, once higher then that amount it gives me an error.
 Below is the code I am using to do the insert, it gets the error on the insert and the update both:
 I am getting the error on the price inserting the FormatCurrency(txtprice.Text)
SelectStatement = "Insert crewchief (crewchief, price, car_num) Select '" & txtcrewchief.Text & "', " & FormatCurrency(txtprice.Text) & ", '" & txtcarnum.Text & "'"
Adapter.SelectCommand = New SqlClient.SqlCommand(SelectStatement, myConnection)
MyCommandBuilder = New SqlClient.SqlCommandBuilder(Adapter)
Adapter.Fill(MatcherDS, "temp")
Any ideas on why?
 
Thank you

View 2 Replies View Related

CASE Statement Error: Cannot Convert A Char Value To Money

Nov 6, 2007

I am trying to write a Procedure in SQL 2005 that retreives a list of rows from the database. I pass to the procedure sorting parameters. This procedure works fine for all of the fields that I enter in the Order By, except for one.
The field that does not work is a varchar(500) field (named Description).
I am not sure what the problem is.
The error that I am getting is:

Msg 235, Level 16, State 0, Line 13

Cannot convert a char value to money. The char value has incorrect syntax.

Attached is the T-SQL Code. The declare and set statements in the beginning are for informational purposes.
Any help is appreciated.
------------------------------------------------------------------------------------------------------
declare @Match varchar(75)

declare @NumRows int

declare @StartPos int

declare @OrderBy varchar(25)

declare @OrderDir varchar(4)


set @Match = 'dog% AND bark%'

set @NumRows = 25

set @StartPos = 100

set @OrderBy = 'Description'

set @OrderDir = 'ASC'


WITH catitems AS

(

SELECT ci.ID, ci.SupplierCode, ci.Description, ci.AUDIO_LINK, ci.SoundLength, ci.HighCost, ci.Channels,

ROW_NUMBER() OVER (ORDER BY

CASE

WHEN @OrderBy='ID' AND @OrderDir='ASC'

THEN CAST(ci.ID AS int)

WHEN @OrderBy='SupplierCode' AND @OrderDir='ASC'

THEN CAST(ci.SupplierCode As int)

WHEN @OrderBy='Description' AND @OrderDir='ASC'

THEN CAST(ci.[Description] As varchar(500))

WHEN @OrderBy='HighCost' AND @OrderDir='ASC'

THEN CAST(ci.HighCost AS money)

WHEN @OrderBy='Channels' AND @OrderDir='ASC'

THEN CAST(ci.Channels AS smallint)

END ASC,

CASE

WHEN @OrderBy='ID' AND @OrderDir='DESC'

THEN CAST(ci.ID AS int)

WHEN @OrderBy='SupplierCode' AND @OrderDir='DESC'

THEN CAST(ci.SupplierCode As int)

WHEN @OrderBy='Description' AND @OrderDir='DESC'

THEN CAST(ci.[Description] As varchar(500))

WHEN @OrderBy='HighCost' AND @OrderDir='DESC'

THEN CAST(ci.HighCost AS money)

WHEN @OrderBy='Channels' AND @OrderDir='DESC'

THEN CAST(ci.Channels AS smallint)

END DESC) As RowNo

FROM TableName As ci

WHERE CONTAINS (ci.Keywords, @Match) AND ShowOnWeb=1

)

SELECT catitems.ID,

catitems.SupplierCode,

catitems.Description,

catitems.AUDIO_LINK,

catitems.HighCost,

catitems.Channels

FROM catitems

WHERE RowNo BETWEEN @StartPos AND @StartPos + @NumRows -1
------------------------------------------------------------------------------------------------------


Thanks,

Aric


View 1 Replies View Related

BULK INSERT ERROR Using Format File - Bulk Load Data Conversion Error

Jun 29, 2015

I'm trying to use Bulk insert for the first time and getting the following error. I think it might have something to do with my Format File and from the error msg there's a conversion error for the first column. In my database the Field is nvarchar(6) so my best guess is to use SQLNChar for the first column. I've checked the end of each line is CR LF therefore the is correct for line 7 right?

Msg 4863, Level 16, State 1, Line 1
Bulk load data conversion error (truncation) for row 1, column 1 (ASXCode).
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".

BULK
INSERTtbl_ASX_Data_temp
FROM
'M:DataASXImportTest.txt'
WITH
(FORMATFILE='M:DataASXSQLFormatImport.Fmt')

[code]...

View 5 Replies View Related

Time Format Error

Dec 20, 2005

What do you think of a query that generates aSystem.Data.SqlClient.SqlException when submitted via a application,but when run through QueryAnalyzer or EnterpriseManager doesn'tgenerate a error? Here are 2 examples of the query:SELECT table1.*,table2.field1,table2.field2,table2.field3 FROMtable1,table2 WHERE table1.field1 = table2.field1 ANDtable1.field2='103' ANDtable2.TStamp > '12/19/2005 12:20:14 PM' ORDER BY table2.TStampSystem.Data.SqlClient.SqlException: Line 1: Incorrect syntax near '12'.SELECT table1.*,table2.field1,table2.field2,table2.field3 FROMtable1,table2 WHERE table1.field1 = table2.field1 ANDtable1.field2='103' ANDtable2.TStamp > '12/8/2005 8:29:43 AM'ORDER BY table2.TStampSystem.Data.SqlClient.SqlException: Line 1: Incorrect syntax near '8'.I believe the error is referencing the hour portion of the timestamp.When I run these queries through QA/EM I don't get a result set ... somaybe those apps just trap the exception and ignore it. Still, seeanything wrong with the TStamp?

View 4 Replies View Related

Format Parameter Error

Dec 26, 2006

Hi all, i am a newbie to reporting services. Hope someone can help me with this date problem.

I have a parameter date which i declared as type string in the report manager. when i entered the date as eg) "31/12/2003" and clicked on the 'preview' tab in the report manager, it gives me error saying that 'Cast from string "31/12/2003" to type 'Date' is not valid.'

So i use the cultureinfo function to set the date to 'en-US' format.... something like the one below:

CStr( Format(DateTime.Parse( Parameters!strDateTo.Value , New System.Globalization.CultureInfo("en-US")), "dd-MMM-yyyy"))

This works perfectly in my preview tab. But when i deployed to the server and when viewed on IE, it gives me an error msg -> "#Error" instead. Why is that so??

I have also checked my pc regional settings . It's set to United States and the date format is also "dd/MM/yyyy". Have also checked the settings in the server and it's also set to the same format. But i am still getting this error.

By the way... i am using windows 2003 with SRS 2000 SP2.

Any help will be appreciated. Thks !

View 1 Replies View Related

Format Of The Initialization String Error

Apr 14, 2005

Hi all,
Complete newbie to ASP.NET, but you have to learn some time. Anyway, I am attempting to fill a datagrid from the Northwind database installed on my SQL server at work and I receive the following error when I attempt to compile to check the connection.
Format of the initialization string does not conform to specification starting at index 67.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 67.Source Error:



Line 31:
Line 32: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Line 33: Dim cnn As New SqlConnection( _
Line 34: "Data source=xxxxx;Initial Catalog=Northwind;User ID=sa;Password=;xxxxxx")
Line 35: End SubSource File: C:InetpubwwwrootApp_02default.aspx.vb    Line: 33 Stack Trace:



[ArgumentException: Format of the initialization string does not conform to specification starting at index 67.]
System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, String& keyname, String& keyvalue) +1203
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +127
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useFirstKeyValuePair) +103
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +32
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +25
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolOptions poolOptions, DbConnectionOptions& userConnectionOptions) +119
System.Data.ProviderBase.DbConnectionBase.set_ConnectionString(String value) +53
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +7
System.Data.SqlClient.SqlConnection..ctor(String connectionString) +23
App_02.WebForm1.Page_Load(Object sender, EventArgs e) in C:InetpubwwwrootApp_02default.aspx.vb:33
System.Web.UI.Control.OnLoad(EventArgs e) +102
System.Web.UI.Control.LoadRecursive() +45
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +952

 I have been tearing my hair out trying to work out this error. Can anyone help????
Using VisualStudio.NET 2003 on an XP box and and SQL Server 2000 on a Windows2003 Server box.
Thanks,
Gerald

View 1 Replies View Related

Input String Format Error...Plz Help

May 16, 2005

Looking for some help with a page that is giving me problems. Below is code for the function that I need help with:
  Function MyInsertMethod() As Integer                  Dim connectionString As String = "server=chatt; user id='sa'; password=1234; database=chtt_Fit"& _                     "tings'"                  Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)
                  Dim queryString As String = "INSERT INTO [ProcessYield] ([ProdDate], [CupolaCharge], [MetalPoured], [ToTen],[FeSiCharge],lt1,lt2,lt3,lt4) VALUES (@ProdDate, @CupolaCharge, @MetalPoured, @ToTen, @FeSiCharge,@lt1,@lt2,@lt3,@lt4)"                  Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand                  dbCommand.CommandText = queryString                  dbCommand.Connection = dbConnection
                  Dim ProdDate as String = Calendar1.selecteddate                  Dim ParameterProdDate as New SqlParameter("@ProdDate",SqldbType.datetime, 8)                  ParameterProdDate.Value = ProdDate                  dbCommand.Parameters.Add(ParameterProdDate)
                  Dim MetalPoured as String = TextBox3.Text                  Dim ParameterMetalPoured as New SqlParameter("@MetalPoured",SqldbType.float, 8)                  ParameterMetalPoured.Value = MetalPoured                  dbCommand.Parameters.Add(ParameterMetalPoured)
                  Dim CupolaCharge as String = Textbox1.Text                  Dim ParameterCupolaCharge as New SqlParameter("@CupolaCharge",SqldbType.float, 8)                  ParameterCupolaCharge.Value = CupolaCharge                  dbCommand.Parameters.Add(ParameterCupolaCharge)
                  Dim ToTen as String = Textbox4.Text                  Dim ParameterToTen as New SqlParameter("@ToTen",SqldbType.float, 8)                  ParameterToTen.Value = ToTen                  dbCommand.Parameters.Add(ParameterToTen)
                  Dim FeSiCharge as string = (Textbox5.Text/2000)                  Dim ParameterFeSiCharge as New SqlParameter("@FeSiCharge",SqldbType.float, 8)                  ParameterFeSiCharge.Value = FeSiCharge                  dbCommand.Parameters.Add(ParameterFeSiCharge)
                  Dim lt1 as String = TextBox6.Text                  Dim Parameterlt1 as New SqlParameter("@lt1",SqldbType.float, 8)                  Parameterlt1.Value = lt1                  dbCommand.Parameters.Add(Parameterlt1)
                  Dim lt2 as String = TextBox7.Text                  Dim Parameterlt2 as New SqlParameter("@lt2",SqldbType.float, 8)                  Parameterlt2.Value = lt2                  dbCommand.Parameters.Add(Parameterlt2)
                  Dim lt3 as String = TextBox8.Text                  Dim Parameterlt3 as New SqlParameter("@lt3",SqldbType.float, 8)                  Parameterlt3.Value = lt3                  dbCommand.Parameters.Add(Parameterlt3)
                  Dim lt4 as String = TextBox9.Text                  Dim Parameterlt4 as New SqlParameter("@lt4",SqldbType.float, 8)                  Parameterlt4.Value = lt4                  dbCommand.Parameters.Add(Parameterlt4)
                  Dim rowsAffected As Integer = 0                  dbConnection.Open
                  Try                      rowsAffected = dbCommand.ExecuteNonQuery                  Finally                      dbConnection.Close                  End Try                  Return rowsAffected              End Function
Ok the error happens when a user leaves the textbox5.text empty...pages says not to enter 0 since you can't divide into zero. This page has worked for over a year but recently upgraded from SQL 7.0 to SQL 2000 and is no longer working. 
Have tried converting data types, different data types on server, etc.  Any advise is appreciated. Thanks.  BTW new to forums... if this is wrong board to post on sorry and feel free to move where needed.
Here is submit code if that helps any also:
         Sub Button2_Click(sender As Object, e As EventArgs)             MyInsertMethod()             UpdateDailyActivity()             MXDataGrid1.DataSource = Getsaveresult()             MXDataGrid1.DataBind()             textbox1.text = ""             textbox3.text = ""             textbox4.text = ""             textbox5.text = ""             textbox6.text = "0"             textbox7.text = "0"             textbox8.text = "0"             textbox9.text = "0"
Error Message:
FormatException: Input string was not in a correct format.]   Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value, NumberFormatInfo NumberFormat) +195   Microsoft.VisualBasic.CompilerServices.DoubleType.FromString(String Value, NumberFormatInfo NumberFormat) +84[InvalidCastException: Cast from string "" to type 'Double' is not valid.]   Microsoft.VisualBasic.CompilerServices.DoubleType.FromString(String Value, NumberFormatInfo NumberFormat) +173   Microsoft.VisualBasic.CompilerServices.DoubleType.FromString(String Value) +7   ASP.CupolaYieldEntry_aspx.MyInsertMethod() in D:ProductionControlyieldcupolayieldentry.aspx:76   ASP.CupolaYieldEntry_aspx.Button2_Click(Object sender, EventArgs e) in D:ProductionControlyieldcupolayieldentry.aspx:142   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33   System.Web.UI.Page.ProcessRequestMain() +1292

View 1 Replies View Related

Invalid Date Format Error ... Please Help ...

May 2, 2002

Hi,

I'm using ODBC (System DSN) to connect to SQL Server 7.0 Database.
Whenever I try to connect to SQL Server Database from my client
application, I'm getting the following error message -

----------------------------------------------------------
Microsoft SQL Server has reported the following error:

[Microsoft] [ODBC SQL Server Driver] Invalid Date format
----------------------------------------------------------


After this message, I'm getting another error message -

----------------------------------------------------------

Cannot create a record in table SysConfig (SysConfig).
The SQL Database has issued an error.

----------------------------------------------------------

Subsequently, I get another error message -

-----------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Invalid date format [INSERT INTO SYSCONFIG

(CONFIGTYPE,ID,VALUE,MODIFIEDDATE,MODIFIEDTIME,MOD IFIEDBY,CREATEDDATE,CREATEDTIME,CREATEDBY,RECID

) VALUES (?,?,?,?,?,?,?,?,?,?)]
-----------------------------------------------------

The application that I'm trying to connect from is a package from 3rd
Party. I do not have any control over it.

But I think the problem could be from the side of SQL Server. Can someone
look into this please?

Thanks,
Harish

View 1 Replies View Related

I/O Error Reading BCP Format File

Jul 20, 2000

I added a field to an exisiting table (CHAR 30), and I added to field to the BCP Format File.
The BCP worked fine before the new field, and still works fine when I exclude the new field
from the format file, but with the new field I receive the following error:

SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]I/O error while reading BCP format file

(2 row(s) affected)

Here is a copy of my format file:
7.0
11
1 SQLCHAR 0 6 "" 1 Empl_ser_no
2 SQLCHAR 0 2 "" 2 Empl_stat_cd
3 SQLCHAR 0 1 "" 3 Guest_type_fl
4 SQLCHAR 0 30 "" 4 Job_tl
5 SQLCHAR 0 14 "" 5 Pager_no
6 SQLCHAR 0 1 "" 6 Security_Clear_fl
7 SQLCHAR 0 9 "" 7 SSN
8 SQLCHAR 0 30 "" 8 Emer_cont_nm
9 SQLCHAR 0 14 "" 9 Emer_cont_no
10 SQLCHAR 0 1 "" 10 Citizen_fl
11 SQLCHAR 0 30 "
" 11 Job_Res

The input file is just a fixed positonal text file, and I have checkid it 100 times- it is fine.

Any sugestions from any BCP gurus out there? THANKS

View 1 Replies View Related

Input String Was Not In A Correct Format. Error

Apr 16, 2008

I have a page where user can insert a new record, i use stroed procedures:ALTER PROCEDURE [dbo].[sp_InsertTypes]
@Type varchar(10),
@Type_Desc varchar(35),
@Contact_Name varchar(20),
@Contact_Ad1 varchar(25),
@Contact_Ad2 varchar(25),
@Contact_City varchar(10),
@Contact_Phone varchar(12),
@Contact_Fax varchar(12),
@Contact_Email varchar(35)
Insert into dbo.Types (Type,Type_Desc,Contact_Name,Contact_Ad1,Contact_Ad2,Contact_City,Contact_Phone,
Contact_Fax,Contact_Email) values (@Type,@Type_Desc,@Contact_Name,@Contact_Ad1,@Contact_Ad2,@Contact_City,
@Contact_Phone, @Contact_Fax,@Contact_Email)
My code is:Protected Sub InsertButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim myConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("myConnectionString").ConnectionString)Dim myCommand As SqlCommand
Dim TypeTxt As TextBox = FormView1.FindControl("TypeTextBox")Dim DescTxt As TextBox = FormView1.FindControl("TypeDescTextBox")
Dim NameTxt As TextBox = FormView1.FindControl("ContactNameTextBox")Dim phoneTxt As TextBox = FormView1.FindControl("ContactPhoneTextBox")
Dim ad1Txt As TextBox = FormView1.FindControl("ContactAd1Textbox")Dim ad2Txt As TextBox = FormView1.FindControl("ContactAd2Textbox")
Dim cityTxt As TextBox = FormView1.FindControl("ContactCityTextbox")Dim faxTxt As TextBox = FormView1.FindControl("ContactFaxTextbox")
Dim emailTxt As TextBox = FormView1.FindControl("ContactEmailTextbox")myCommand = New SqlCommand("[dbo].[sp_Insert_Types]", myConnection)
myCommand.CommandType = CommandType.StoredProcedure
myCommand.Parameters.Add("@Type", SqlDbType.BigInt).Value = TypeTxt.Text
myCommand.Parameters.Add("@Type_Desc", SqlDbType.VarChar).Value = DescTxt.Text
myCommand.Parameters.Add("@Contact_Name", SqlDbType.VarChar).Value =  NameTxt.Text
myCommand.Parameters.Add("@Contact_Phone", SqlDbType.VarChar).Value = phoneTxt.Text
myCommand.Parameters.Add("@Contact_Ad1", SqlDbType.VarChar).Value = ad1Txt.Text
myCommand.Parameters.Add("@Contact_Ad2", SqlDbType.VarChar).Value = ad2Txt.Text
myCommand.Parameters.Add("@Contact_City", SqlDbType.VarChar).Value =  cityTxt.Text
myCommand.Parameters.Add("@Contact_Fax", SqlDbType.VarChar).Value =  faxTxt.Text
myCommand.Parameters.Add("@Contact_Email", SqlDbType.VarChar).Value = emailTxt.Text myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
End Sub
 I have almost the identical procedure & code for Update command button, and worked well, what am I doing wrong? I even tried adding ' in front and after the texts.
Thank you.

View 5 Replies View Related

Help With Input String Was Not In A Correct Format Error

May 29, 2008

I am trying to execute an SQL update statement as follows:myObj.Query("Update Schedule Set visitorScore=" + t1 + ", homeScore=" + t2 + " where id=" + Convert.ToInt16(HID.Value));However, I'm getting the following error message with regards to this line.: Exception Details: System.FormatException: Input string was not in a correct format.  Could anyone please tell me what is wrong with this line?  I have tried many different versions of this, but keep getting the same error. THANKS IN ADVANCE! 

View 3 Replies View Related

Error: Input String Was Not In A Correct Format?

Oct 20, 2005

Hi experts,  I am working on my asp.net application and received an error message on   dr = cmdGetFile.ExecuteReader:Error: Input string was not in a correct format. Can someone help me out of this?  Thank you in advance.------------------------------------------------------------------------------------ #Region " Web Form Designer Generated Code "
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()        Me.cmdGetFile = New System.Data.SqlClient.SqlCommand        Me.dbHRConn = New System.Data.SqlClient.SqlConnection        '        'cmdGetFile        '        Me.cmdGetFile.CommandText = "SELECT App_Resume_FileSize, App_Resume_FileName, App_Resume, App_Resume_FileType " & _        "FROM Mgmt_App_Resume_Table WHERE (Applicant_ID = @AppID)"        Me.cmdGetFile.Connection = Me.dbHRConn        Me.cmdGetFile.Parameters.Add(New System.Data.SqlClient.SqlParameter("@AppID", System.Data.SqlDbType.SmallInt, 2, "Applicant_ID"))        '        'dbHRConn        '        Me.dbHRConn.ConnectionString = "the connection string"
    End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load        Dim dr As System.Data.SqlClient.SqlDataReader        cmdGetFile.Parameters("@AppID").Value = Request("Applicant_ID")        dbHRConn.Open()        dr = cmdGetFile.ExecuteReader
        If dr.Read Then            Response.ContentType = dr("App_Resume_FileType").ToString            Response.OutputStream.Write(CType(dr("App_Resume"), _              Byte()), 0, CInt(dr("App_Resume_FileSize")))            Response.AddHeader("Content-Disposition", _              "attachment;filename=" + dr("App_Resume_FileName").ToString())        Else            Response.Write("File Not Found.")        End IfEnd Sub

View 5 Replies View Related

[mssql] I/O Error While Reading BCP Format File

Feb 29, 2000

Hi All,

I had a problem today where BCP would not read the format file I created giving the following error:

I/O error while reading BCP format file.

I searched the archives here at swynk.com and found a thread titled exactly the same as the one I am now creating. There were numerous responses to this thread but none of them seemed to solve the problem for me (short of the one that suggested using BCP to create the format file, which I didn't want to do).

I used BCP to create a format file for me (which looked identical to the format file that I created) and it worked fine. With my suspicions aroused, I used a binary file viewer to look at the contents of each file and highlight the differences. Apart from the usual variations in whitespace I noticed that the my file did not have any carriage returnline feed at the end of the last row definition.

My format file ended at the end of the last row definition line. It did not have any carriage returns and line feeds. I matched the one generated by BCP and added the following "

" to the end of the file, tested my format file and it worked perfectly.

The moral of the story is, make sure when you create a format file, you have an empty line at the end of the file (ie: after your last "Server Column Name", make sure you have "

" sans quotes).

Hope this saves someone a few hours :-)

Cheers,
Dan.

View 1 Replies View Related

Error When I Try To Bulk Insert With A Format File

Oct 1, 2007



Msg 4862, Level 16, State 1, Server PATH-SQLDEV, Line 2
Cannot bulk load because the file "c:DATABATCHBCPFormat.fmt" could not be read. Operating system error code (null).

Above is the error I get. The problem is I do not know what is causing this error. It occurs when I attempt to use SQLCMD with bulk insert.

I am using SQLserver 2005 and I have a similar set up in a test database that works, why this format file does not is beyond me, but my experience is when the format file has an error in it, such as a mispelled datatype or a incorrect column number, the error will zero in on that, rather then declare the entire file unreadable. Furthermore if I go into the file, change something so where it is incorrect (like a column number) it will zero in on that error. So I know that the format file can be read. If I knew what this error was all about I would at least know where to begin in fixing it. I have also tried using a very small sample file for the data being inserted. Same error.

Please help

View 2 Replies View Related

FTP Using DTS. Error Invalid Format For String Source Names

Mar 31, 2004

Hi,
I am trying to do a simple ftp using DTS. I am using a Dynamic properties task as the file name is a bit complicated eg - f2368fd1.ext.040330.2
where 040330 is according to the date and the .2 is the second file for the day.
When i run the task, it fails giving me the error "Invalid format for string source names"

I then tried to use a simple file name such as TD.txt as a constant in the Dynamic properties task but still it fails. Any ideas ??

Thanks in Advance

View 2 Replies View Related

MSRT - Error With Exporting The Reports To Excel Format.

Jul 26, 2007

I tried to export a report to excel format. I am getting the below error(Array Index out of bounds). The report is around 12 pages. Any thoughts on this?


Server Error in '/Reports' Application.


Index was outside the bounds of the array. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: Index was outside the bounds of the array.

Source Error:





An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:





[Exception: Index was outside the bounds of the array.]

[Exception: An error occurred during rendering of the report.]

[Exception: An error occurred during rendering of the report.]
Microsoft.Reporting.WebForms.ServerReport.ServerUrlRequest(Boolean isAbortable, String url, Stream outputStream, String& mimeType, String& fileNameExtension) +489
Microsoft.Reporting.WebForms.ServerReport.InternalRender(Boolean isAbortable, String format, String deviceInfo, NameValueCollection urlAccessParameters, Stream reportStream, String& mimeType, String& fileNameExtension) +924
Microsoft.Reporting.WebForms.ServerReportControlSource.RenderReport(String format, String deviceInfo, NameValueCollection additionalParams, String& mimeType, String& fileExtension) +84
Microsoft.Reporting.WebForms.ExportOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) +153
Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +75
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +303
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64


Santhosh

View 2 Replies View Related

OLE DB Error: Format Of The Initialization String Does Not Conform To The OLE DB Specification.

Feb 11, 2008

It is SQL Server 2005. I am trying to create an SSIS package for OUR database engine with OUR OLE DB provider.

In Server Explorer I am trying to add a data connection for OUR database using OUR own ole db data provider. Procedure below-
1. Right click "Data Connections"
2. Click "Add Connection...", "Change Data Source" dialog is displayed.
3. Select "other" and ".NET Framework Data Provider for OLE DB". Click OK. "Add Connection" dialog is displayed.
4. Select "OLE DB Provider". I selected OUR provider.
5. Edit necessary properties. Click OK.
6. An error dialog is displayed saying "Format of the initialization string does not conform to the OLE DB specification."

I did some tracing. My observations are-

Connection string is built internally as
"Provider=MYOLEDB;Password=password;Data Source=myserver;User ID=admin;Initial Catalog=SYSTEM;Window Handle=984398;Prompt=CompleteRequired"

The last property causes this issue. i.e. presence of 'Prompt=CompleteRequired' is the problem.

I tried this with simple c# test program to connect. If I pass the whole connection string as above to OleDbConnection() it gives the error--
"Format of the initialization string does not conform to the OLE DB specification."

It works fine if I pass connection string removing last property, i.e.
"Provider=MYOLEDB;Password=password;Data Source=myserver;User ID=admin;Initial Catalog=SYSTEM;Window Handle=984398"

So the problem is that the connection string built contains 'Prompt=CompleteRequired' at the end. Our provider returns DBPROMPT_NOPROMPT for DBPROP_INIT_PROMPT property. Still why the connection string is built as 'Prompt=CompleteRequired'?

Probably this is because of missing something in properties/implementation. What is it?


Thanks,
Vivek.

View 4 Replies View Related

Error In Downloading EXCEL Format From Reporting Services

Oct 5, 2007



Hi

Can someone help debug this error while downloading to EXCEL format from RS? I notice that whenever i trim down the length of my report name, the error has not occurred.

The error encountered was:

View 2 Replies View Related

Error In Downloading EXCEL Format From Reporting Services

Oct 7, 2007



Hi

Can someone help debug this error while downloading to EXCEL format from RS? I've notice that whenever I trimmed down the length of my report name, the error has not occurred.

The error encountered was:

View 2 Replies View Related







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