locked
Ms access and go daddy RRS feed

  • Question

  • User-1705975166 posted

     am unable to write into the table of MS access file in godaddy(works in localhost).....is their any settings that needs to be changed???

     Dim MySQL As String = "Insert into mainregistration (name,usernamee,passwordd,college,department,yearr,emailid,contactno) " & _
           "Values (@name,@usernamee,@passwordd,@college,@department,@yearr,@emailid,@contactno)"

            Dim MyConn As New OleDbConnection(strConn)
            Dim Cmd As New OleDbCommand(MySQL, MyConn)
            With Cmd.Parameters
                .Add(New OleDbParameter("@name", name.Text))
                .Add(New OleDbParameter("@usernamee", username.Text))
                .Add(New OleDbParameter("@passwordd", password.Text))
                .Add(New OleDbParameter("@college", college.SelectedValue))
                .Add(New OleDbParameter("@department", department.SelectedValue))
                .Add(New OleDbParameter("@yearr", year.SelectedValue))
                .Add(New OleDbParameter("@emailid", emailid.Text))
                .Add(New OleDbParameter("@contactno", contactno.Text))
            End With
            MyConn.Open()
            Cmd.ExecuteNonQuery()
            MyConn.Close()
     

     

    Operation must use an updateable query.

    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.Data.OleDb.OleDbException: Operation must use an updateable query.

    Source Error:

    Line 34: 
    Line 35: MyConn.Open()
    Line 36: Cmd.ExecuteNonQuery()
    Line 37: MyConn.Close()
    Line 38:

     This is the error i get....need help....thanx

     

    Saturday, June 20, 2009 12:57 AM

All replies

  • User2019981500 posted

    Hi,
    i don't know whether you will agree ,but i have experienced this error hell lots of times,but after doing some R & D,I found there can be so many reasons for it,

    like

    1. if you will Right click on MsAccess,you will see this file in Read Only mode,so you need to remove Read only checkbox

    2.  may be your MsAccess in workGroup and you don't have write permissions,fine you can just make sure that your MsAccess is in standalone modei mean Any user who opens the Access database for update must have full permissions to the folder where the database is located. This is so the Jet database engine can create, update and delete the corresponding .LDB file that is used to track user access to the database.

    .

    difficult to recall every point,just try with this,if still it doesn't work let me know,i will give you some other solutions

    Thanks

    shabir hakim

    Monday, June 22, 2009 1:52 AM
  • User-1199946673 posted

    http://www.mikesdotnetting.com/Article.aspx?ArticleID=74

    I don't know whether you can set permissions on GoDaddy. You should ask them whether you can do that yourself or if they can do that for you. In shared hosting, sometimes there's a special map for Access Databases, ussualy outside the webroot.

    Monday, June 22, 2009 2:59 AM
  • User2019981500 posted

    Hey Great Man

    just use below code.only thing i want you to check whether your access database has read only checkbox unchecked and make sure folder in which msaccess resides have read write permission

    just replace my fiels with yours....

     protected void btnRegister_Click(object sender, EventArgs e)
        {
            try
            {
                OdbcConnection objConn = new OdbcConnection();
                string user = "user";
                String strsql = "INSERT INTO UserMaster_Tbl(User_Password,User_Type,User_Status,User_FirstName,User_DOB,User_EmailID,User_Country,User_Sex)VALUES('" + txtpassword.Text + "','" + user + "',1,'" + txtfirstname.Text + "','" + Convert.ToDateTime(txtdob.Text) + "','" + txtemailid.Text + "','" + ddlcountry.SelectedItem.Text + "','" + ddlcountry.SelectedItem.Text + "')";
                objConn.ConnectionString = ConfigurationManager.ConnectionStrings["DBMyFaithConStr"].ConnectionString;
                OdbcCommand objcmd = new OdbcCommand(strsql, objConn);
                objcmd.CommandType = CommandType.Text;
                objConn.Open();
                objcmd.ExecuteScalar();
                objConn.Close();
                lblmessage.ForeColor = System.Drawing.Color.Green;
                lblmessage.Text = "Registered Successfully";
            }
            catch (Exception ex)
            {
                lblmessage.ForeColor = System.Drawing.Color.Red;
                lblmessage.Text = ex.Message;
            }
        }
     

    /////////////////html content file///////////

     

     <div class="divFieldset">
            
        <br />
               <form id="frmAccount" runat="server" action="" class="clsForm" method="post" name="frmAccount" onsubmit="try{Verify();return false;}catch(e){return true;}"
                    style="margin: 0px; width: 450px">
                <fieldset id="fsAccount" style="left: 0px; top: 0px" >
                    <legend id="lgAccount" style="left: 0px; width: 151px; top: -10px"><span class="fi_subhead">
            <img align="absMiddle" border="0" height="18" src="../images/newuser.gif" width="15">
             Register  Now</span>
                       </legend>
                   <label id="idEmailAddress" class="requiredText">
                        <span class="requiredIcon" style="color: #6d2d16">*</span>Email Address:</label> 
                  
                          <asp:textbox cssclass="Textbox"  onfocus="showHelpTip('emailHelp')" ID="txtemailid" runat="server" onblur="hideHelpTip('emailHelp')" 
    ></asp:textbox >
                      <asp:regularexpressionvalidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtemailid"
                          ErrorMessage="*" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Width="15px"></asp:regularexpressionvalidator><br />
                    <label id="idPassword" class="requiredText">
                        <span class="requiredIcon" style="color: #6d2d16">*</span>Password:</label> 
                  
                          <asp:textbox cssclass="textbox" ID="txtpassword" runat="server" TextMode="Password"></asp:textbox ><br />
                    <label id="idRe-typePassword" class="requiredText">
                        <span class="requiredIcon" style="color: #6d2d16">*</span>Re-type Password:</label> 
                 
                          <asp:textbox cssclass="textbox" ID="txtretypepassword" runat="server" TextMode="Password"></asp:textbox>
                      <asp:comparevalidator ID="CompareValidator1" runat="server" ControlToCompare="txtpassword"
                          ControlToValidate="txtretypepassword" ErrorMessage="*" Width="17px"></asp:comparevalidator><br />
                   
                    <label id="idFirstLastName" class="requiredText">
                        <span class="requiredIcon" style="color: #6d2d16">*</span>First, Last Name:</label>
                     
                 
                          <asp:textbox cssclass="textbox" ID="txtfirstname" runat="server"></asp:textbox><br />
                    <label id="idCountry" class="optionalText">
                        <span style="color: #6d2d16">*</span>Country:</label> 
                          
                          <asp:dropdownlist ID="ddlcountry" runat="server">
                          </asp:dropdownlist><br />
                    <label id="idStreetAddress" class="optionalText">
                        <span style="color: #6d2d16">*</span>Date of Birth:</label>
                     <asp:textbox cssclass="textbox" ID="txtdob" runat="server"></asp:textbox >
                   <br />
                   <asp:label ID="lblmessage" runat="server"></asp:label>
                    <div class="fieldsetButton">
                        
                         <asp:button ID="btnRegister" runat="server"  Text="Register" OnClick="btnRegister_Click" /></div>
                </fieldset>
               </form>
    
            </div>
      

     

    Monday, June 22, 2009 5:02 AM
  • User-1199946673 posted

    make sure folder in which msaccess resides have read write permission

    No, you need MODIFY permissions on the folder. Instead of all the research, read the link I provided in my previous post!

    And maybe you should do also somes research on SQL injections and Parameterized Queries.

    http://www.mikesdotnetting.com/Article.aspx?ArticleID=26

    And when you want to Execute an Insert, use ExecuteNonQuery, instead of ExecuteScalar. And when you want to insert a date without using parameters. you need to enclose them in #, not in ´, which is used for strings...

    Monday, June 22, 2009 9:02 AM
  • User-1705975166 posted

     Thank u shabir

    Tuesday, June 23, 2009 1:58 AM