Jump to content

narayana_anthati

Members
  • Posts

    24
  • Joined

  • Last visited

Posts posted by narayana_anthati

  1. I have data bind text boxes.It is an update form in a web application.I'm using .net 2005 and VB. I want to update the database after I changed the text in the text box.When click update button database doesn't effect new text that i changed in text box. Please help me.
    Can u explain clearly.I am not getting u r problem Exatlt.Any how i am sending some code verify this.This is in c#.SqlDataReader dr; s = "select * from ProductDetails where ProductId='" + r + "' "; SqlCommand cmd = new SqlCommand(s, conn); conn.Open(); cmd.Connection = conn; dr = cmd.ExecuteReader(); while (dr.Read()) { TextBox1.Text = dr[0].ToString(); TextBox2.Text = dr[1].ToString(); TextBox4.Text = dr[3].ToString(); TextBox5.Text = dr[4].ToString(); TextBox6.Text = dr[5].ToString(); TextBox7.Text = dr[7].ToString(); TextBox8.Text = dr[8].ToString(); DropDownList1.Text = dr[9].ToString(); TextBox9.Text = dr[10].ToString(); } }If it is not help full plz send u r code i will see that one. RegardsNarayana
  2. Hi friends, I'm using .NET 2005 & vb. I want to get hyperlink text from a SQL database and after clicked the hyperlink want to quary from the hyperlink text.If eny one can please help me quicklyThank u.
    Hai ,Just bind data to the text as below and write the the query string of which u r requesting in the form load<asp:HyperLink id="hyp" Text ='<%#DataBinder.Eval(Container.DataItem,"categorylist") %>' runat ="server" > </asp:HyperLink>This the format if u have any doubts plz let me knowRegardsNarayana
  3. --------------------------------------------------------------------------------What I'm trying to do is set up a column in the datagrid to take an initial path + the remaining path from the dataset. I had done this in Visual Studio 2003 using VB, but am trying to convert it to C# for the purpose of expanding knowledge and because the client wanted it in C#.This is my code on the HTML page pertaining to the datagrid (The datagrid is only going to be a side by side grid of images that are to be clicked to provide a link to the companies website). The code inside the image tag is based on converting what I had done in VB (as opposed to C#) into what I thought would work here. There are no errors, but it doesn't seem to be pulling the information from the datasource.
    <asp:DataGrid runat="server" ID="dgCompany"><Columns><asp:TemplateColumn><ItemTemplate><asp:ImageButton runat="server" ID="imgCompanyLogo" ImageUrl='<%#"/YHIS/Company" + (Container.DataItem = "ClientLogoLocation")%>' /></ItemTemplate></asp:TemplateColumn></Columns></asp:DataGrid>

    Here is the Backend code, very simply, DataGet is a class I made that just cuts off a few lines of code (the data adapter and setting the datasource up based on the sqlCommand given)

    protected void Page_Load(object sender, EventArgs e){DataSet DS = new DataSet();DS = DataGet.getDataSet("SELECT ClientLogoLocation FROM tblClient");if (!Page.IsPostBack){dgCompany.DataSource = DS;dgCompany.DataBind();}else{dgCompany.DataSource = DS;}}

    Fairly simply, I would greatly appreciate any advice or if I'm missing something blatantly obvious on this matter. Or if you have a different way for me to set it so that the images from the path fill the datagrid that's fine. I am sure I could do it in the backend code but I believe that would be a lot more intensive and require the use of a for loop.

    Hai , Here i am sending some sample code.Retriving images from database to datagird by appropriate path. SqlConnection conn = new SqlConnection("Data Source=sqlserver;Initial Catalog=OmArtPrint;Integrated Security=True"); DataSet ds = new DataSet(); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { bindGrid(); } } private void bindGrid() { cid1 = Request.QueryString["cid"].ToString(); try { conn.Open(); String sqlstmt = "select pid,ProductList,Price,ProdDesc,Prodimglink from productlist SqlDataAdapter myda = new SqlDataAdapter(sqlstmt, conn); myda.Fill(ds); datagrid1.DataSource = ds; datagrid1.DataBind(); conn.Close(); } catch (Exception ex) { Response.Write(ex.Message.ToString()); }And Html Code <asp:DataGrid ID="datagrid1" runat ="server" AutoGenerateColumns ="False" Width="557px" CellPadding="4" ForeColor="#333333" GridLines="None" Height="147px" style="color: black" AllowPaging="True" HorizontalAlign="Center" > <Columns > <asp:TemplateColumn HeaderText ="details"> <ItemTemplate > <img src='<%#DataBinder.Eval(Container.DataItem, "Prodimglink")%>' ID="ProdImage" name="1" runat=server /> </ItemTemplate> </asp:TemplateColumn> <asp:BoundColumn DataField ="Pid" HeaderText ="Pid"></asp:BoundColumn> <asp:BoundColumn DataField ="ProductList" HeaderText ="ProductLIst"></asp:BoundColumn> <asp:BoundColumn DataField ="Price" HeaderText ="Price"></asp:BoundColumn> <asp:BoundColumn DataField ="ProdDesc" HeaderText ="ProductDesc"></asp:BoundColumn> </Columns> </asp:DataGrid>
  4. Hai EveryBody , Can anybody Help me Regarding Paging Concept in DataList Control.I have done some coding to get page numbers but how to fix ,how many elements in a row and column,and how to break to next page to display.PlzThanks in advanceRegardsnarayana

  5. What everyone is saying is that you need to change your Stored Procedure so that you look up the category based on some unique identifier (that doesn't change). Perhaps something like this:
    CREATE PROCEDURE SP_Updatecategorylist(@CategoryID int,@CategoryName varchar(50))ASUPDATE categorylist SET CategoryName = @CategoryName WHERE CategoryID = @CategoryID

    Perhaps the SQL Tutorial might help.

    Thanks now it workingRegardsnarayana
  6. CREATE PROCEDURE SP_Updatecategorylist @categorylist nvarchar(50) AS UPDATE categorylist SET categorylist = @categorylist WHERE categorylist = @categorylist;According to this SP, you send a parameter to the SP and see in the table, fieldname [categorylist] has that value,If it has the value then update it with the same parameter value.it will be the same value, i dont see any update.....Pls check your stored procedure...
    If any body having sample code plz send me its very urgent or plz rectify my problem please.Regardsnarayana
  7. Hai , I got problem with updation of datagrid.It editing but when we press update it is not working.Plz Help me it's very urgent.Thanks in advance.Here i am sending my code:protected void datagrid1_UpdateCommand(object source, DataGridCommandEventArgs e) { System.Web.UI.WebControls.TextBox cName = new System.Web.UI.WebControls.TextBox(); cName = (System.Web.UI.WebControls.TextBox)e.Item.Cells[2].Controls[0]; SqlCommand mycommand = new SqlCommand("SP_Updatecategorylist", conn); mycommand.CommandType = CommandType.StoredProcedure; mycommand.Parameters.Add(new SqlParameter("@categorylist", SqlDbType.NVarChar, 50)); mycommand.Parameters["@categorylist"].Value = cName.Text; conn.Open(); mycommand.ExecuteNonQuery(); conn.Close(); datagrid1.EditItemIndex = -1; BindData(); }Stored Procedure:CREATE PROCEDURE SP_Updatecategorylist @categorylist nvarchar(50) AS UPDATE categorylist SET categorylist = @categorylist WHERE categorylist = @categorylist;
    Hai, It is not giving any error but but when we click the update button it just coming back as before with out any updation.If ypu have any code please send me it's very urgent.Regardsnarayana
  8. Hai , I got problem with updation of datagrid.It editing but when we press update it is not working.Plz Help me it's very urgent.Thanks in advance.Here i am sending my code:protected void datagrid1_UpdateCommand(object source, DataGridCommandEventArgs e) { System.Web.UI.WebControls.TextBox cName = new System.Web.UI.WebControls.TextBox(); cName = (System.Web.UI.WebControls.TextBox)e.Item.Cells[2].Controls[0]; SqlCommand mycommand = new SqlCommand("SP_Updatecategorylist", conn); mycommand.CommandType = CommandType.StoredProcedure; mycommand.Parameters.Add(new SqlParameter("@categorylist", SqlDbType.NVarChar, 50)); mycommand.Parameters["@categorylist"].Value = cName.Text; conn.Open(); mycommand.ExecuteNonQuery(); conn.Close(); datagrid1.EditItemIndex = -1; BindData(); }Stored Procedure:CREATE PROCEDURE SP_Updatecategorylist @categorylist nvarchar(50) AS UPDATE categorylist SET categorylist = @categorylist WHERE categorylist = @categorylist;

  9. Hai, When i am using Rabge Validator Control for password length.It is giving error as "The MaximumValue 12 cannot be less than the MinimumValue 6 of password"Why it is giving like this plz help me.<asp:RangeValidator ID ="password" runat ="server" ControlToValidate ="tb2" MinimumValue ="6" MaximumValue ="12" Type ="String" ErrorMessage="<small>Minimum of six letters</small>" BackColor="White" BorderColor="White" BorderStyle="Dashed"> </asp:RangeValidator>Regardsnarayana

  10. I do not see any prblems with your code except that if an exception does occur MessageBox.show() will fail because that is on for Windows Forms not Web Forms...you have to use javascript alert() for web messsages.
    Thanks for u r reply.from that no problem.But how can i use alert if the user alredy exists.plz send me.In my validation Range validator also not working>plz send me how to work with these two things.Regardsnarayana
  11. Hai every one, i am facing problem on the users creation form.Before creation of validation's it's working.After that it throwing exception as "Thread has been Aborted" and the then it is showing User alredy exits and gowing to successful creation page.Plz help me.My Code Is:SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; try { cmd.CommandText = "insert into login values('" + tb1.Text + "','" + tb2.Text + "','" + ddl1.Text + "','" + tb3.Text + "','" + tb4.Text + "','" + tb5.Text + "','" + tb6.Text + "','" + tb7.Text + "','" + tb8.Text + "','" + tb9.Text + "','" + tb10.Text + "','" + ddl2.Text + "')"; conn.Open(); cmd.ExecuteNonQuery(); tb1.Text = ""; tb2.Text = ""; tb3.Text = ""; tb4.Text = ""; tb5.Text = ""; tb6.Text = ""; tb7.Text = ""; tb8.Text = ""; tb9.Text = ""; tb10.Text = ""; Response .Redirect ("registrationcompleate.aspx"); conn.Close(); } catch (Exception ex) { //Response.Write(ex.Message.ToString ()); MessageBox.Show(ex.Message.ToString()); MessageBox.Show("User Already Exists Choose Different Name", "User"); tb1.Text = ""; } }Thanks in advance;Regardsnarayana

  12. Hai, Can any body help me.i am new to c#.net.In vb we have message box.Like that how we can use messagebox's in c#.Plz send me it's urgentThanks in advanceRegards,Narayana
    Hai, But it is asking assembly reference.plz send which is refers.regardsnarayana
  13. Hai, Can any body help me.i am new to c#.net.In vb we have message box.Like that how we can use messagebox's in c#.Plz send me it's urgentThanks in advanceRegards,Narayana

  14. the errror is with this lineServer.Transfer("Registartion Compleate");You must specify a page to Transfer to...it is not for displaying messages.Server.Transfer works similarly to Response.Redirect with some performance diffrences.
    Thanks for u reply now its workingRegardsnarayana
  15. hai when i am udating data i am facing Error executing child request for Registartion Compleate.But the data is updating.Can any body rectify my problem.code is:public partial class Usersupdate : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { } } protected void Button2_Click(object sender, EventArgs e) { tb1.Text = ""; tb2.Text = ""; tb3.Text = ""; tb4.Text = ""; tb5.Text = ""; tb6.Text = ""; tb7.Text = ""; tb8.Text = ""; tb9.Text = ""; tb10.Text = ""; } protected void Button1_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection("Data Source=sankhya03;Initial Catalog=OmArtPrint;Integrated Security=True"); //Dim con As New SqlClient.SqlConnection(System.Configuration.ConfigurationManager.AppSettings("Connection")); SqlCommand cmd=new SqlCommand() ; cmd.Connection = conn; try { cmd.CommandText ="update login set pwd='"+tb2 .Text +"',title='"+ddl1 .Text +"' , firstname='"+tb3.Text +"' , lastname='"+tb4.Text +"' , phone='"+tb5.Text +"' , email='"+tb6.Text +"' , address='"+tb7.Text +"' , city='"+tb8.Text +"' , state='"+tb9.Text +"' , postal='"+tb10.Text +"' , howuheard='"+ddl2 .Text +"' where username='"+tb1.Text +"'"; conn.Open(); cmd.ExecuteNonQuery(); tb1.Text = ""; tb2.Text = ""; tb3.Text = ""; tb4.Text = ""; tb5.Text = ""; tb6.Text = ""; tb7.Text = ""; tb8.Text = ""; tb9.Text = ""; tb10.Text = ""; Server.Transfer("Registartion Compleate"); conn.Close(); } catch(Exception ex) { Response.Write(ex.Message.ToString ()); }}

  16. HaiWhen i am giving indidual connection my application is working.But when a key word from web.config i am getting error.SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("Connection"));Where i Bolded in that spot i am getting error.The error is System.Configuration.ConfigurationSettings.AppSettings is a property but it is used as a method.Thanks in advanceRegardsNarayana

  17. hai,When i am binding data to a datagrid i am getting error at this line plz any one help me.datagrid1.DataSource = ds.Tables("categorylist").defaultview;MY TOTAL CODE IS:SqlConnection conn = new SqlConnection("Data Source=sankhya03;Initial Catalog=OmArtPrint;Integrated Security=True"); DataSet ds = new DataSet(); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { bindGrid(); } } private void bindGrid() { try { string sqlstmt = "select * from categorylist where pcid=0"; SqlDataAdapter myda = new SqlDataAdapter(sqlstmt, conn); myda.Fill(ds, "categorylist"); datagrid1.DataSource = ds.Tables("categorylist"); //datagrid1.DataSource = ds.Tables("categorylist"); //datagrid1.DataSource = ds.Tables("categorylist").defaultview; datagrid1.DataBind(); } catch (Exception ex) { Response.Write(ex.Message.ToString()); } }Thanks in advance.its very urgent.Regardsnarayana

  18. Hi, In my application i am getting an error on the query plz help me.i wrote the query as "UPDATE LOGIN(PASSWORD) SET VALUES('"+TEXTBOX3.TEXT+"').If there is any error plz send me.It's very urgent.Thanks in advaneRegards,narayana

  19. Hai, I am new member to this group.Can any body helpme.It is like a shopping cart project.For that i have taken one datalist.there i kept "addto cart" If i press it has to store in shoppingcart page.plz help me this very urgentThanks in advance,Regardsnarayana

×
×
  • Create New...