DigitalSolution
Guppy
Hi,
I'm having trouble with my .net application...
I have a file that has a datagrid and the code is as follows:
	
	
	
		
I have also a backend c# file which contains the implementation:
	
	
	
		
It works absolutely fine on my local server here but I am not sure why it isn't working on the JodoHost server... I get an unspecified error when doing that.... I just thought I would post and see what's wrong.... Can you please help?
Thanks!
				
			I'm having trouble with my .net application...
I have a file that has a datagrid and the code is as follows:
		Code:
	
	<asp:datagrid id="MyDataGrid" runat="server" OnDeleteCommand="MyDataGrid_Delete" DataKeyField="ID" HeaderStyle-BackColor="#CCCCCC"
				Font-Size="10pt" Font-Name="Arial" CellSpacing="1" CellPadding="3" ShowFooter="false" Width="700">
				<Columns>
					<asp:ButtonColumn Text="Delete News Item" CommandName="Delete" />
				</Columns>
			</asp:datagrid>I have also a backend c# file which contains the implementation:
		Code:
	
	public void Page_Load(Object sender, EventArgs e)
		{
			myConnection = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["DBConnectionString"]);
			if (!IsPostBack)
				BindGrid();
		}
		public void MyDataGrid_Delete(Object sender, DataGridCommandEventArgs e)
		{
			String deleteCmd = "DELETE from News where ID = @Id";
			SqlCommand myCommand = new SqlCommand(deleteCmd, myConnection);
			myCommand.Parameters.Add(new SqlParameter("@Id", SqlDbType.NVarChar, 11));
			myCommand.Parameters["@Id"].Value = MyDataGrid.DataKeys[(int)e.Item.ItemIndex];
			myCommand.Connection.Open();
			try
			{
				myCommand.ExecuteNonQuery();
				Message.Text = "<b>Record Deleted</b><br>" + deleteCmd;
			}
			catch (SqlException)
			{
				Message.Text = "ERROR: Could not delete record";
			}
			myCommand.Connection.Close();
			BindGrid();
		}
		public void BindGrid()
		{
			SqlDataAdapter myCommand = new SqlDataAdapter("select * from News", myConnection);
			DataSet ds = new DataSet();
			myCommand.Fill(ds, "News");
			MyDataGrid.DataSource=ds.Tables["News"].DefaultView;
			MyDataGrid.DataBind();
		}It works absolutely fine on my local server here but I am not sure why it isn't working on the JodoHost server... I get an unspecified error when doing that.... I just thought I would post and see what's wrong.... Can you please help?
Thanks!
 
				 
						