i want the following jsp code to be converted in c#... cud anyone help me...

ResultSet resultset, resultset1;
            String localityid,villageid;
            
            Connection connection= DriverManager.getConnection("jdbc:odbc:rmcwhDSN");
            Statement statement= connection.createStatement();
            String familyid = request.getParameter("familyid"); 
            String tempSQL = "select * from HOUSEHOLDMEMBERS where FamilyId='"+familyid+"'";
            //out.println(tempSQL);
            resultset=statement.executeQuery(tempSQL);
            String tempMemberid="";
            String tempNum="";
            while(resultset.next())
            {
            tempMemberid = resultset.getString("MemberId"); 
            }
            //out.println(tempMemberid);
            int count1 = tempMemberid.length();
           // out.println(count1);
            
            //if(countl >2 ) {
                String memnum = tempMemberid.substring(count1-2);
                int memno = (new Integer(memnum)).intValue();
                //out.println ("Last member sq. number " + memno);                           
                memno++;
                String seqNo = Integer.toString(memno);
               // out.println ("Last member sq. number " + seqNo);                           
                if(memno < 10) {
                    tempMemberid = familyid.concat("0").concat(seqNo);
                }else{
                    tempMemberid = familyid.concat(seqNo);
                }

i have tried but getting sum errors.............

protected void TextBox1_TextChanged(object sender, EventArgs e)
    {

        ResultSet resultset, resultset1;
        String localityid, villageid;
        
            SqlConnection conn = new SqlConnection(@"Data Source=RICKY-PC\SQLEXPRESS;Initial Catalog=rmcwh;Integrated Security=True");
            SqlCommand cmd = new SqlCommand();
         //   cmd.Connection = conn;

            conn.Open();




            String familyid = Request.QueryString["familyid"];
            String tempSQL = "select * from HOUSEHOLDMEMBERS where FamilyId='" + familyid + "'";
            //out.println(tempSQL);
            SqlCommand comm = new SqlCommand(tempSQL, conn);
            

            //resultset=statement.executeQuery(tempSQL);

            String tempMemberid = "";
            String tempNum = "";
            while (resultset.next())
            {
                tempMemberid = resultset.getString("MemberId");
            }
            //out.println(tempMemberid);
            int count1;
            count1 = tempMemberid.Length;
            // out.println(count1);
        
            //if(countl >2 ) {
            String memnum = tempMemberid.Substring(count1 - 2);
            int memno = (new Integer(memnum)).intValue();
            //out.println ("Last member sq. number " + memno);                           
            memno++;
            String seqNo = Integer.toString(memno);
            // out.println ("Last member sq. number " + seqNo);                           
            if (memno < 10)
            {
                 tempMemberid = familyid.concat("0").concat(seqNo);
            }
            else
            {
                tempMemberid = familyid.concat(seqNo);
            }
            // }    
            //tempMemberid = familyid.concat(count2);%>

       }

Please use CODE tags.

protected void TextBox1_TextChanged(object sender, EventArgs e)
    {
        SqlConnection conn = new SqlConnection(@"Data Source=RICKY-PC\SQLEXPRESS;Initial Catalog=rmcwh;Integrated Security=True");
        conn.Open();

        //     ResultSet resultset, resultset1;

        String localityid, villageid;
        String familyid = Request.QueryString["familyid"];

        String tempSQL = "select * from HOUSEHOLDMEMBERS where FamilyId='" + familyid + "'";  //out.println(tempSQL);


        SqlCommand comm = new SqlCommand(tempSQL, conn);
        SqlDataReader r = comm.ExecuteReader();

        //resultset=statement.executeQuery(tempSQL);


        String tempMemberid = "";
        String tempNum = "";
           while (r.Read())
        {
            
            tempMemberid = r.GetString("MemberId");
/* getting error here ----	Argument '1': cannot convert from 'string' to 'int'	* .... rest of the code is fine.../
        }
        

        int count1;
        count1 = tempMemberid.Length;  // out.println(count1);

        

        String memnum = tempMemberid.Substring(count1 - 2);
        int memno = Convert.ToInt32(memnum);
             
                               
        memno++;

        String seqNo = memno.ToString();
                             
        if (memno < 10)
        {
            tempMemberid = string.Concat(familyid, 0,seqNo);
    
        }
        else
        {
            tempMemberid = string.Concat(familyid, seqNo);
    
        }
        

      r.Close();
        conn.Close();
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.