Start New Discussion within our Web Development Community

hello
i am trying to insert data to Data base using Stored Proc , while i replace my Connection string in the web.config file
after i run my app , and inserting my data..
it says

Keyword not supported: 'data base'.

i am trying to attach a screen shoot but i cnt find any tool here to attach with !! ;s

when i edited data base to database.. it ddnt work .
it says

Sunday, December 29, 2013 12:43 AM <dir> bin
Wednesday, January 01, 2014 11:57 AM 3,894 ContactUs.aspx
Wednesday, January 01, 2014 12:23 PM 1,902 ContactUs.aspx.cs
Wednesday, January 01, 2014 11:57 AM 5,658 ContactUs.aspx.designer.cs
Sunday, December 29, 2013 12:43 AM 4,256 ContactUs.csproj
Sunday, December 29, 2013 12:43 AM 1,086 ContactUs.csproj.user
Sunday, December 29, 2013 12:04 AM <dir> obj
Sunday, December 29, 2013 12:04 AM <dir> Properties
Wednesday, January 01, 2014 04:11 PM 547 Web.config
Sunday, December 29, 2013 12:04 AM 1,285 Web.Debug.config
Sunday, December 29, 2013 12:04 AM 1,346 Web.Release.config

where is that paper clip ?

Please post your web.config file. Feel free to censor user names, server names, and passwords. It looks like the connection string is malformed for the information you've already provided.

here you are a compy of my web.config file

<?xml version="1.0"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
  <connectionStrings>
    <add
      name="myConnectionString" 
      connectionString=" Data Source=. ; Data Base = ContactUsDB ; Integrated Security = true"
      providerName="System.Data.SqlClient"></add>

  </connectionStrings>
    <system.web>
        <compilation debug="true" targetFramework="4.0" ></compilation>
    </system.web>

</configuration>

and this is my code

 protected void Button1_Click(object sender, EventArgs e)
        {



        string conString = ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;
        SqlConnection con = new SqlConnection(conString);
        SqlCommand Cmd = new SqlCommand();
        Cmd.CommandType = CommandType.StoredProcedure;
        Cmd.CommandText = "Sp_ContactUs_Insert";


        Cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = TxtName.Text.Trim();
        Cmd.Parameters.Add("@Email", SqlDbType.VarChar).Value = TxtEmail.Text.Trim();
        Cmd.Parameters.Add("@Phone", SqlDbType.VarChar).Value = TxtPhone.Text.Trim();
        Cmd.Parameters.Add("@MailSubject", SqlDbType.VarChar).Value = TxtSubject.Text.Trim();
        Cmd.Parameters.Add("@Body", SqlDbType.VarChar).Value = TxtBody.Text.Trim();
        try
        {
        Cmd.Connection = con;

            con.Open();
            if (Cmd.ExecuteNonQuery() > 0)
            {
                Label1.Text = " Your Message Has been Sent , Thank you";
            }
            else
            {
                Label1.Text = " There is an error... please try again later";
            }
        }

        finally
        {
            con.Close();
            con.Dispose();

        }
This article has been dead for over six months. Start a new discussion instead.