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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Format of the initialization string does not conform to specification starting at index 0.

Posted By:      Posted Date: October 15, 2010    Points: 0   Category :ASP.Net


I am getting the error above when i click on a button...



View Complete Post

More Related Resource Links

Help me with this error Format of the initialization string does not conform to specification starti


I am getting this error-- Format of the initialization string does not conform to specification starting at index 0. whenever i want to insert some record into DB using store procedures.

 String cstr = ConfigurationManager.ConnectionStrings["cstr"].ConnectionString;
       SqlConnection con = new SqlConnection("cstr"); 
        cmd = new SqlCommand("insert1", con);
        cmd.CommandType = CommandType.StoredProcedure;  
         cmd.Parameters.Add(new SqlParameter("@empid", SqlDbType.VarChar)).Value = TextBox1.Text;  
         cmd.Parameters.Add(new SqlParameter("@name", SqlDbType.VarChar)).Value = TextBox2.Text;  

and my connection string in web.config

		<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
			<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35

Usual solutions not the problem for Format of the initialization string does not conform to specific

I know that there are normally two causes/solutions for the "Format of the initialization string does not conform to specification starting at index 0" error message.  The two normal suggestions are a problem with the connection string or it is surrounded by quotes in Dimming the connection. I get the message while running in debug (though it is pulling the selected row ID value correctly).However neither of those are the case in my file.  I know the connection string is configured correctly because it works in the rest of the page.  Further I don't have quotes in the Dim connection part.  Relevant bits of code below.Imports System.Web.UI.WebControls Imports System.Web.UI.WebControls.ImageButton Imports System.Web.UI.WebControls.DataControlField Imports System.Data Imports System.Data.SqlClient Imports System.Configuration Imports System.Object Imports System.DirectoryServices Partial Class Default2 Inherits System.Web.UI.Page 'Private auth As authenticate 'Private dt As DataTable 'Private programs As DataRow() Private dbConnection As String = "KMConnectionString" . . . Sub btnPlay(ByVal sender As Object, ByVal e As EventArgs) 'grab video ID Dim videoID = GridView1.SelectedValue.ToString() Response.Write(videoID) Dim con As New SqlConnection(dbConnection)

Error when instantiating MySqlDataAdapter "Format of the initialization string..."


<%@ Page Language="javascript"%>

I'm writing a website that's a little heavy on the database connection calls, so I've decided to try to encapsulate it in a Javascript pseudo-class.  When I try to instantiate the MySqlDataAdapter, I get the error "Format of the initialization string does not conform to specification starting at index 0."  While I can appreciate this, I've used the same connection string (more or less) across many pages now, without issue when I'm not trying to use this class.

I'm a little confused - does anyone have any idea why line would be throwing this error?

On a side note, is there any way to post code in a <textarea> or something like it?  This nifty little javascript wrapped textbox keeps erasing all my tags.  :)

The Error Message

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 0.

Source Error: 

Line 16: 		
Line 17: 	this.command = new MySqlCommand( "", this.sql );
Line 18: 	this.adapter = new MySqlDataAdapter( "&

Input string was not in a correct format.


Hi, I just started learning asp.net

i set simple application but i get this error that  "Input string was not in a correct format"

Input string was not in a correct format.

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:

Line 10:     protected void Page_Load(object sender, EventArgs e)
Line 11:     {
Line 12:         decimal num1 = Decimal.Parse(txtNumber1.Text);
Line 13:         decimal num2 = Decimal.Parse(txtNumber2.Text);
Line 14:         decimal ans = num1 + num2;

How can I correct this error




Cannot FindByThumbprint - Invalid Hexadecimal string format

I'm trying to set up a sample WCF service using a self-signed certificate.  For some reason, I repeatedly get the error "FormatException - Invalid hexadecimal string format." I was initially trying it in the config file but decided to try setting it up in code but still get the same error. I then tried it on a different machine and it works just fine.  I would appreciate any suggestions.  Here are the details. Environment:  Windows 7 Home Premium, Visual Studio 2010 C# Express Edition, .NET 4.0 Code:     // Create the host ServiceHost host = new ServiceHost(hostType);     string valueToFind = "‎‎‎‎‎66 31 bf 9e f7 4f 9e b6 c9 d5 a6 0c ba 6a be d1 f7 bd ef 7b"; host.Credentials.ServiceCertificate.SetCertificate(   StoreLocation.CurrentUser, StoreName.Root, X509FindType.FindByThumbprint, valueToFind);     The exact same code runs just fine on another machine.  No complaints of an invalid hexadecimal value.  Here are the details of the other machine: Environment:  Windows XP, Visual Studio 2010 C# Premium, .NET 4.0 Any ideas?

SlideShowExtender - Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.web

Hello,   I put a SliderShowExtender and i created a web service with a function that return AjaxControlToolkit.Slide(), but when a run the project give me the error: Microsoft JScript runtime error: Sys.Net.WebServiceFailedException: The server method 'returnLogo' failed with the following error: <html>    <head>        <title>Unknown web method 'returnLogo'.<br>Parameter name: methodName</title>        <style> ...   Anybody know why?   Tks

Input string was not in a correct format.

I am trying to convert a null value to a double value using convert function in C#. Can anybody help me in this regards... I am getting a null value in a variable named "gridCol1" Step 1 - I am doing                Convert.ToDouble ( gridCol1.ToString() );                Error : "Input string was not in a correct format."

My problem with an gridView, Input string was not in a correct format.

Hello all ! I'am actually encounter problem with an gridView which is composed of five columns, the both first are string type, third is date and the two last are linkbutton to edit or delete rows. On clicking edit button, i catch good event to edit and traitment  work fine but on living function an error occur with this message : error : System.FormatException: Input string was not in a correct format. stackTrace :   [FormatException: Input string was not in a correct format.] System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +7471479 System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +119 System.Web.UI.WebControls.GridView.GetRowIndex(GridViewRow row, String commandArgument) +99 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +602 System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +207 System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175 System.Web.UI.Page.ProcessRequestMain(Boolean inclu

SQL Server not starting - FallBack certificate initialization failed

I can not start my SqlServer 2008 Express. The problem seemed to start when I changed my "Built In account, Log in as" from Local Service to Local System. If I try to change back to Local Service I get the messagebox with WMI Provider Error, "Cannot find object or property. [0x80092004]". Getting a bit confused, but read http://support.microsoft.com/kb/900497    mentioned about  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib, Value name: Certificate, Type: REG_SZ not having a valid value then 2005 would not starte - my value is blank. Changing it to 0 did not work.How can I import a valid certificate using SQL Server Configuration Manager. And how do you turn off Forced Encryption? Not sure if this would fix it, but couldn't hurt.====================================== 2009-03-08 01:39:06.01 Server      Error: 17190, Severity: 16, State: 1.2009-03-08 01:39:06.01 Server      FallBack certificate initialization failed with error code: 1.2009-03-08 01:39:06.01 Server      Unable to initialize SSL encryption because a valid certificate could not be found, and it is not possible to create a self-signed certificate.2009-03-08 01:39:06.01 Server      Error: 17182, Severity: 16, State: 1.2009-03-08 01:39:06.01 Server      TDSSNIClient initialization failed with error 0x80092004, status code 0x80. Reason: Unable to i

Need to convert query string(date - 09/15/2010) to a text format - yyyymmdd

I am fairly new to C # and need some assistance with a form page.  I have created a simple form that requires the user to select a beginning date and ending date.  I then pass the values to my code behind page via query strings.  I have them passing, but I need the format to be change to a different format.  Unfortunately the database does not use the standard date format.  It requires the date to be in a text format as YYYYMMDD.Form: <tr> <td> Beginning Date:</td> <td><asp:TextBox runat="server" ID="begDate"></asp:TextBox> <asp:Image ID="Image2" ImageUrl="~/images/calendar_schedulehs.png" runat="server" /></td> </tr> Code Behind: protected void createReport_Click(object sender, EventArgs e) { StringBuilder url = new StringBuilder("Report/TopCustomer.aspx?"); url.Append("BegDate=" + begDate.Text); url.Append("&EndDate=" + endDate.Text); url.Append("&Brnch=" + ddlLocation.SelectedValue); Response.Redirect(url.ToString()); Current URL: TopCustomer.aspx?BegDate=09/15/2010&EndDate=09/30/2010&Brnch=300I need to have the above URL change to:TopCustomer.aspx?BegDate=20100915&E

MSG durring Installatioin:Input String was not in a correct format

I am in the process in installing SQL  Express 2008-R2. While running Setup, the following box pops up: SQL Server Steup faulure. SQL Server Setup has ecountered the following error: Input string was not in a correct format... Any ideas on how to correct this? Thanks in advance.  


Hi all,Here's some simple code<a href='<%= string.Format("../Print/Print1.aspx?withParameter={0}", Para )%>'>HyperLinkText</a>and it works well. so i guess i can write anything like this, so i wrote a test:<input type="button" value="Btn1" onclick='<%= string.Format("window.open('','_blank')") %>'/> <input type="button" value="Btn2" onclick="window.open('','_blank')"/>However, Btn1 does not work.. for some reason i have to NOT to use server control, so i wite it in inline-code style,why the first hyperlink work well, but Btn1 fails?could anyone tell me?thank you~

Input string was not in a correct format.


DropDownList ddlCardDetails = LoginView2.FindControl("ddlCardDetails") as DropDownList;

        BurnbetDataContext ctx = new BurnbetDataContext("data source=.\\SQLEXPRESS;Integrated Security=SSPI;" +
                           "AttachDBFilename=|DataDirectory|\\BurnbetDatabase.mdf;User Instance=true");

            int Id = Convert.ToInt32(ddlCardDetails.SelectedValue.Split('|')[0]);
            tbl_Payment democustomer = ctx.tbl_Payments.SingleOrDefault(c => c.ID == Id);

        if (democustomer != null)




Input string was not in a correct format


I am trying to update a coulmn in datatable but keep getting error:

Input string was not in a correct format.Couldn't store <&nbsp;> in SortOrder Column.  Expected type is Int32.

SortOrder is column of Type Integer that either contain Null or number.

Any ideas? below is my code

   If e.CommandName = "Reset" Then
            Dim index As Integer = Integer.Parse(e.CommandArgument)
            dt = CType(Cache("dt"), DataTable)
            Dim value As Integer = 0
            value = Convert.ToInt32(dt.Rows(index)("ContentID").ToString())

            Dim SortOrderNum As Integer = 0
            SortOrderNum = dt.Rows(index)("SortOrder").ToString()
            dt.Rows(index)("SortOrder") = DBNull.Value   'dt.Rows(index - 1)("SortOrder")

            dtNew = dt.Copy()
            dgArticles.DataSource = dt
            Dim i As Integer = 0
            For i = 0 To dgArticles.Rows.Count - 1
                dtNew.Rows(i)("ContentID") = dgArticles.Rows(i).Cells(0).Text

                dtNew.Rows(i)("Headline") = dgArticles.Rows(i).Cells(1).Text

                dtNew.Rows(i)("SiteName") = dgArticles.Rows(i).Cells(2

datetime formating with string.format


I have a table in my SQL DB that is a DateTime table, what I want to do is take the numeric datetime it stores and convert it to a long date (i.e. 12/12/2012 conversts to December 12, 2012). Seaching the forums it looks like the string.format is the way to go and searching for info on that I found http://www.csharp-examples.net/string-format-datetime/ which lists all the different formats but they do not list a formating string to convert to the format I want to use. Does anyone know what format string I would use to convert a numeric date to a long date like I want? And can you show it in a code example because I am not 100% sure I understand the code examples shown on that site.

dateTime string format


when my system date separator set to "-", the following return the date format with "dd-mm-yyyy HH:mm"

DateTime b = DateTime.ParseExact(date, "dd/MM/yyyy HH:mm", provider);
                            strDate = b.ToString("dd/MM/yyyy HH:mm");

return strDate;


why? how can i return the dayeformat with "/" separator ingore PC datatime setting

Format String


My Data String is 2010-02-10

How to Change format data string  day-month-year

Ex. 10-02-2010 but Data is String

Thank You.

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