How To Format A String When Pulling From A Dataitem
Mar 24, 2006
I seem to be having a problem in getting a string formatted correctly that I'm pulling from a SQL Datasource.
I'm trying to format a Datalist, and more specifically, a Paypal "Add to Cart" button that's supposed to pass several values to another page. The problem I have is with passing the price amount. All the data is in a SQL Express database and the price field is in the database as "money". However it outputs the dollar amount with too many trailing zeros, for example $6.00 is formatted as 6.0000. I'm trying to pass it into the form variable with this code:
Unfortunately, that tends to make include the trailing zeros and mess up the ability to pass the variable. Can anyone help me with how to format this variable so there's no trailing zeros, just so that $6.00 comes out as 6.00 and not 6.0000?
I am currently building an ecommerce site using aspx, vbscript, & sql.
In my productlist control containing a datalist I am trying to use an if statement to determine if products are from a certain supplier... and if they are; display a phone number to call for pricing rather than the price, since this particular supplier doesnt allow pricing of their products online.
supplier = objConn.Execute("Select SupplierID From Product")
If supplier = "C" Then
Response.Write("Call 1-800-POO-STAIN")
Else
Response.Write(" Sug. Retail:") DataBinder.Eval(Container.DataItem, "Price") End IF
objConn.Close
objConn = Nothing
%> This code gives me the following error message: The component 'ADODB.Connection' cannot be created. Apartment threaded components can only be created on pages with an <%@ Page aspcompat=true %> page directive
Can anybody help me get this working?
I haven't worked with VBScript for acouple years now and I'm a little rusty.
I have date coming to one page as a string in the following format"May 4 2005 12:00AM" I need to query one of my tables using this date in combination of other nondate values. How can I convert this date into valid sql server datetime format before I query a database tables Please help
I have a table which stores date-of-birth in varchar 19861231(yyyymmdd). A view takes this data. I want to store this date as mmddyyyy in the view. How can we achieve this?
I have to convert From Sybase to SQL Server and I've got fields type in Sybase which are long varchar (length around 60000). At first, I convert in format text but SQL Server refused to pass this type for parameters in stored procedures when i need that. So I have used varchar(8000) in stored procedures. But I'm afraid it would be truncated in the application. So what is long varchar in SQL Server and how to use that by optimistic way ? Thanks
In this case i cant use cast(TimeDifference as decimal(16,2)) becasse eg : 12.98888882542533 values after writing this sql cast(TimeDifference as decimal(16,2)) gives me this result ===== 12.99====wrong!
i want to display like this 12.98
Ho do I do this task ? what is the best way to format like this ? Is there any straight methods to do this task ? sujithf
I do a select and concatinating the answers into a one column table @tab(string). Is it possible to format these values like this: GENAV DELAV TOTIP RES 12 myvalues www.notech.com 1 1 starthere 192.168.0.2 1 125 or here www.hereistomanychar.s 0
max 3 max 10 max 22 max 1
the first column max 3 characters the second column max 10 char... I want to do this to get a good view of the data i the table @tab
I'm retrieving data from a cube using a datareader, all the measures have format string, but when retrieve from Integration services it's lost.
I know there is a way to get the format string as columns using extended properties of the conection. I haven't tried this yet, but is there any way of reapplying this format to the columns using this format strings??
I get this error when executing a stored procedure from my code. I suppose something's going wrong with data types, but I cannot see what. If anyone has a sharper eye and can see what it is, please let me know. Thanks in advance!Here is a code excerpt: int category = Convert.ToInt32(ddlCategories.SelectedValue); int museum = Convert.ToInt32(ddlMuseums.SelectedValue); int collection = Convert.ToInt32(ddlCollections.SelectedValue); string binomen = txtScientName.Text; string locality = txtLocality.Text; command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@taxparent", category)); command.Parameters.Add(new SqlParameter("@museum", museum)); command.Parameters.Add(new SqlParameter("@collection", collection)); command.Parameters.Add(new SqlParameter("@binomen", binomen)); command.Parameters.Add(new SqlParameter("@locality", locality));And the stored procedure code: ALTER PROCEDURE [petrander].[DynamicQuery] @taxparent int = NULL, @museum int = NULL, @collection int = NULL, @binomen Nvarchar(254) = NULL, @locality Nvarchar(254) = NULLAS SELECT * FROM QueryView WHERE InstitutionCode = COALESCE(@museum, InstitutionCode) AND CollectionCode = COALESCE(@collection, CollectionCode) AND ScientificName LIKE '%' + @binomen + '%' AND Locality LIKE '%' + @locality + '%' AND ParentID1 = COALESCE(@taxparent, ParentID3) OR ParentID2 = COALESCE(@taxparent, ParentID2) OR ParentID3 = COALESCE(@taxparent, ParentID3) OR ParentID4 = COALESCE(@taxparent, ParentID4) OR ParentID5 = COALESCE(@taxparent, ParentID5) OR ParentID6 = COALESCE(@taxparent, ParentID6) OR ParentID7 = COALESCE(@taxparent, ParentID7) OR ParentID8 = COALESCE(@taxparent, ParentID8)
I am using SQL Server Express and Visual Web Developer Express with VB as my preferred language. I am trying to specify an InsertParameter with a querystring parameter of a SQLDataSource Control. My Code is: <InsertParameters> <asp:Parameter Name="ProjectID" Type="Int32" DefaultValue="Convert.ToInt32(Label1.Text)" /> <asp:Parameter Name="Name" Type="String" /> <asp:Parameter Name="Description" Type="String" /> <asp:Parameter Name="Size" Type="Int32" /> </InsertParameters> </asp:SqlDataSource> I get the error message above and the detail is: 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.FormatException: Input string was not in a correct format.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:
I have verified that Label1.Text has a value that looks like an integer. What is causing the problem? Is there a better way of creating a new record in the child table and making one of the fields match the primary key of the parent table? Thanks.
Hi!I get this message: System.FormatException: Input string was not in a correct format. when i try to execute this code: TextBox tbox = new TextBox(); string Date; string Title; string Text; string sUserName = HttpContext.Current.User.Identity.Name; MembershipUser User = Membership.GetUser(sUserName); string UserID = User.ProviderUserKey.ToString(); int NewsID = Convert.ToInt32(ViewEditNews.DataKeys[e.Item.ItemIndex]);
tbox = (TextBox)e.Item.FindControl("EditNewsDateTxt"); Date = tbox.Text;
tbox = (TextBox)e.Item.FindControl("EditNewsTitleTxt"); Title = tbox.Text;
tbox = (TextBox)e.Item.FindControl("EditNewsTextTxt"); Text = tbox.Text;
Hello, this is my code and the problem is "Input string was not in a correct format." Dim connection As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("cnn"))
Dim percentage, jaar, kpi3, maand1 As IntegerDim cmd As SqlCommand = New SqlCommand
Hi i keep getting an error when i search based on the coachname textbox or the team name dropdown list, when I search based on the region dropdown list it works fine. The error i get is "Input string was not in a correct format" Here is my code; protected void Button1_Click(object sender, EventArgs e) {
if (this.IsValid) {
lblResults.Text = "Here are the search results!"; }
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["streamConnectionString"].ConnectionString); conn.Open();
SqlCommand command = new SqlCommand("stream_FindTeam", conn); command.CommandType = CommandType.StoredProcedure;
And my stored procedure is ALTER PROCEDURE [dbo].[stream_FindTeam] @coachName varchar(100), @TeamName varchar(100), @regionID INT AS SELECT TeamID, coachName FROM Teams WHERE coachName LIKE COALESCE(@coachName, coachName) AND TeamName = COALESCE(@TeamName, TeamName) AND regionID = COALESCE(@regionID, regionID);
Hi, im using vb,net sql 2005. I keep getting this error when inserting on one of my forms, normally i debug and have no probs solving this sort of thing but the error below isnt giving me anything to work on, could someone point me in the right direction. Any help would be appreciatedThanks
Hi,I am trying to Update using SqlDataSource.I get the error: Input string was not in a correct format. Does anyone know what would cause this?Thanks,Jon
Hi i hope someone can help with my problem, im quite nb to asp.net. while im trying to update or insert the record i encountered the this error Input string was not in a correct format. I only encounter this only in one field (value_char9) pls note this is varchar2 in the table. the problem encounter when i try to input value greater than sign e.g. >1000, but if there no symbol updating and insertion work fine. If PageMode = "Add" ThencmdSql = New OleDbCommand("Select id From r_feclas Where fec_key='" & strFType & "' And fec_type='PNTTYP' And code_status<>'I'", sqlConn)intKPTId = cmdSql.ExecuteScalar()'cmdSql = New OleDbCommand("Select mond.Nextval From dual", sqlConn) : intId = cmdSql.ExecuteScalar()Dim cmdSql2 As OleDbCommand = New OleDbCommand()Dim sqlTrans As OleDbTransaction = sqlConn.BeginTransaction()cmdSql2.Connection = sqlConn : cmdSql2.Transaction = sqlTransTry 'cmdSql2.CommandText = "Select last_doc_num From r_docnum Where doc_type='MOND' FOR UPDATE" 'intId = cmdSql2.ExecuteScalar() + 1 'cmdSql2.CommandText = "Update r_docnum Set last_doc_num=" & intId & " Where doc_type='MOND'" cmdSql2.CommandText = "Select Mond.NextVal From dual" intId = cmdSql2.ExecuteScalar()sqlTrans.Commit()Catch ex As ExceptionsqlTrans.Rollback()lblErrorMsg.Text = ex.Message : lblErrorMsg.Visible = TrueReturnEnd TrystrSql = "Insert Into r_mondat (read_date, value_num1, value_char1, value_char2, value_char3, value_char4, value_char5, " & _ "value_char6, value_char7, value_char8, value_char9, value_char10, value_char11, value_char12, " & _ "value_char13, value_char14, value_char15, value_char16, value_char17, value_char18, value_char19, Id, " & _ "last_updt, updt_user, created_on, created_by, tag, position, key_pnt, tag_fe_id, positn_fe_id, keypnt_fe_id, " & _ "key_pnt_type_grp, key_pnt_type, form_type, key_pnt_type_id) " & _ "Values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,SYSDATE,'" & Cache(Session.SessionID & "_UserId") & "',SYSDATE,'" & Cache(Session.SessionID & "_UserId") & "'," & _ "'" & strT & "','" & strP & "','" & strK & "'," & intT & "," & intP & "," & intK & ",'" & strFType & "','" & strFType & "','" & strFType & "'," & intKPTId & ")"ElseintId = dgrdData.DataKeys(0) strSql = "Update r_mondat Set read_date=?, value_num1=?, value_char1=?, value_char2=?, value_char3=?, value_char4=?, value_char5=?, " & _ "value_char6=?, value_char7=?, value_char8=?, value_char9=?, value_char10=?, value_char11=?, value_char12=?, " & _ "value_char13=?, value_char14=?, value_char15=?, value_char16=?, value_char17=?, value_char18=?, value_char19=?, " & _ "last_updt=sysdate " & "Where id=?" End If cmdSql = New OleDbCommand(strSql, sqlConn) cmdSql.Parameters.Add("@R1", OleDbType.Date).Value = dtDate cmdSql.Parameters.Add("@N1", OleDbType.Numeric).Value = GetValueFromDataGrid("N1") For i = 1 To 19 cmdSql.Parameters.Add("@C" & i, OleDbType.VarChar, 20).Value() = GetValueFromDataGrid("C" & i) Next cmdSql.Parameters.Add("@Id", OleDbType.Numeric).Value = intId Try cmdSql.ExecuteNonQuery() lblErrorMsg.Text = "Data Updated Successfully." dgrdData.EditItemIndex = -1 If PageMode = "Add" Then RetrieveLeakData(intId) Else RetrieveLeakData() Catch ex As Exception lblErrorMsg.Text = ex.Message Finally sqlConn.Close() End Try lblErrorMsg.Visible = True Trace.Write("lnkUpdate_Click End")
I have the information below PRINT REPLACE(REPLACE(CONVERT(varchar(50), GetDate()), ' ', ''), ':', '') What I would Like to do is run the query above and get date of this type '2003-05-08 12:35:29.998' returned as '20030508123529998' I know GetDate does not even come up with date in the first format so I need to know which way to get it in the first format so that I can run the query and get the second format string returned to me. Thanks in Advance
************* Edited by moderator Adec *************** Inserted missing < code></ code> tags. Always include such tags when including code in your postings. Don't force the moderators to do this for you. Many readers disregard postings without the code tags. **************************************************
I've been workin on this a while and hope I just missed something simple. I have a login page that looks in the db for the rec_id that has the correct un/pw combo. Simple u'd think but I keep getting that error. Any help is greatly appreciated.
Private Sub CheckUser(ByVal CurrentSQLCommand As SqlCommand) 'Declare vars for user and pass. Not needed now but will be used for input checking later Dim strUN As String = txtUN.Text Dim strPW As String = txtPW.Text
SqlConnection1.Open() Dim datareader As SqlDataReader = CurrentSQLCommand.ExecuteReader While datareader.Read If datareader.HasRows Then txtID.Text = datareader(0) If txtR.Text = 3 Then Response.Redirect("hcprov.aspx?id=" & txtID.Text) ElseIf txtR.Text = 2 Then Response.Redirect("hcprof.aspx?id=" & txtID.Text) ElseIf txtR.Text = 1 Then Response.Redirect("hca.aspx?id=" & txtID.Text) End If 'CreateTicket() ElseIf Not datareader.HasRows Then txtUN.Text = "" txtPW.Text = "" lblError.Text = "This User/Pass combo is not valid please try again!" lblError.Visible = True End If datareader.Close() SqlConnection1.Close() End While End Sub
cmdCheckProfUser
SELECT REC_ID FROM dbo.HCPROFESSIONAL WHERE (UN = @un) AND (PW = @pw)
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
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
Can anybody point me to a list of all valid string formats for passing in datetime variables into SQL server. Ideally I just want to put in a date and not bother with a time
I am trying to do an insert into a SQL server table but I am getting an "input string was not in correct format" error. Does this error always refer to SQL string problem? I put in a breakpoint and looked at the SQL and it looks good but until I figure this out I will be tracing through the code. Any input greatly appreciated. MyCmd.CommandText = sSQL MyCmd.ExecuteNonQuery() 'Line where I get the errorThanks,Joe
I'm new here so I'm not sure if this is the correct spot to post this question but here goes.
In the cube design view under the Calculations tab I have several calculated members that I have created. Each of these are dollar amount fields for which I have defined a Format String property as follows:
Format String: "$#,##0;($#,##0);;N/A"
This format correctly handles my positive value, Negative value and my NULL value the way I want. However I need to deloy this cube on one of my UK severs and I don't want the $ but instead I would like the pound sign without having to recreate this entire project to do so. I have tried the following syntax but it is incorrect.
Format String "Currency;;;N/A"
Can someone help me with the correct way to code the property so that I can get my currecy symbol based on the regional setting as well as handle my NULL values.
I am trying to import a txt file that has a string for it's date. How do I change it over in the import wizard I've tried going to advance then changing from string to date or date time but I get an error.
hi, i have a problem. i m inserting data in "dd/mm/yyyy" string format and i want to ocnvert in "dd mon yyyy" format. for eg-- i m entering 30/11/2007" and i wnat in this format "30 Nov 2007"
Hi. I have data which comes as a string like"... Store #61"but sometimes it is"... Store 61"and sometimes it is"... Store 061"For three digits, it might be "... Store 561" or "... Store #561", or"... Store 0561".....The only thing I can be sure of is that the last 2 or 3 (significant)digits of this field represent the StoreNumber.I have to link this table on field StoreNumber with another table wherethe data is ALWAYS like 0061, 0561, etc, so always four digits, paddedwith zeroes.I'd like to use the equivalent of the VB functionFormat(StoreNumber), "0000"), but Format does NOT exist in TSQL.How could I solve this problem ? Please bear with me - I'm a beginnerin SQL...Thank you very muchAlex.
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!!
Hi,I have a funny Error in our sql server 7 & 2000. When I compare twostring in Unicode format. I receive that it is the same when I add newnchar.I don’t understand why?Could you help me ?declare @str nvarchar(128), @str2 nvarchar(128)Set @str =nchar(21121)+nchar(49352)+nchar(47811)+nchar(48256 )+nchar(4966)+nchar(25736)+nchar(1788)+nchar(51220)+nchar(17733)Set @str2 =nchar(21121)+nchar(49352)+nchar(47811)+nchar(48256 )+nchar(4966)+nchar(25736)+nchar(1788)+nchar(51220)+nchar(17733)+nchar(4 1273)select @strselect @str2SELECT DIFFERENCE(@str, @str2)if soundex(@str) = soundex(@str2)BEGINSELECT 'OK'ENDELSEBEGINSELECT 'KO'ENDif @str = @str2BEGINSELECT 'OK'ENDELSEBEGINSELECT 'KO'END-=zoltux=-*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
im using asp.net, C# to enter data into a table in sqlserver...however im getting this error:Input string was not in a correct format.Description: An unhandled exception occurred during the execution ofthe current web request. Please review the stack trace for moreinformation about the error and where it originated in the code.Exception Details: System.FormatException: Input string was not in acorrect format.Source Error:Line 120:cmd.Parameters.Add("@commission",SqlDbType.Money);Line 121:cmd.Parameters["@commission"].Direction=ParameterDirection.Input;Line 122:cmd.Parameters["@commission"].Value =Convert.ToDouble(txtinvoice.Text);Line 123:cmd.Parameters.Add("@pricesold",SqlDbType.Money);Line 124:cmd.Parameters["@pricesold"].Direction=ParameterDirectionSimilar error messages appear when I leave text fields blank that aregoing to be inserted into fields in the table of datatype money,datetime or int...however when i execute this in query analyzer it works and inputs nullvalues for those fields:declare @empid varchar(20), @inventoryid int, @clientid int,@commission money,@pricesold money, @datesold datetime, @invoiceidint, @shippingcost money, @terms varchar(50), @details varchar(50),@clienttype smallint, @checker int, @errordesc varchar(100)set @empid = 'admin'set @inventoryid = 14set @clientid= 2set @clienttype = 0set @commission = nullexec STP_updateconsignment @empid, @inventoryid, @clientid,@commission,@pricesold, @datesold, @invoiceid, @shippingcost, @terms,@details, @clienttype, @checker output, @errordesc outputIf Im in enterprise manager and try to enter a blank value into one ofthose fields I get: The value you entered is not consistent with thedata type or length of the column...so im wondering if the C# page issending my stored procedure a blank value instead of a Null andcausing this error?any advice would be nice..thanks-Jim