Hello all!
Can someone please help me convert this to VB??? My C# is very weak!
Code:protected void btnContinueShopping2_Click(object sender, EventArgs e) { /* if (ViewState["ReturnURL"].ToString() == "") { Response.Redirect(AppLogic.GetCartContinueShoppingURL(SkinID, ThisCustomer.LocaleSetting)); } else { Response.Redirect(ViewState["ReturnURL"].ToString()); } * */ IDataReader rs = DB.GetRS("Select pv.VariantID, pv.Sizes, pv.Colors from ProductVariant pv join product p on pv.ProductID = p.ProductID where p.TrackInventoryBySizeAndColor=1 and (sizes not like '' or colors not like '')"); while (rs.Read()) { string sizes = DB.RSField(rs, "sizes"); string colors = DB.RSField(rs, "colors"); if (sizes.Length > 0 && colors.Length > 0) { String[] colorarray = colors.Split(','); String[] sizearray = sizes.Split(','); int i = 0; while (i < colorarray.Length) { //Clean Price Modifiers if (colorarray[i].ToString().IndexOf('[') != -1) { colorarray[i] = colorarray[i].ToString().Substring(0, colorarray[i].ToString().IndexOf('[') - 1); } int x = 0; while (x < sizearray.Length) { //Clean Price Modifiers if (sizearray[x].ToString().IndexOf('[') != -1) { sizearray[x] = sizearray[x].ToString().Substring(0, sizearray[x].ToString().IndexOf('[') - 1); } DB.ExecuteSQL("insert Inventory(VariantID,Color,Size,Quan) values(" + DB.SQuote(DB.RSFieldInt(rs, "VariantID").ToString()) + "," + DB.SQuote(colorarray[i].ToString()) + "," + DB.SQuote(sizearray[x].ToString()) + ",100)"); x = x + 1; } i = i + 1; } } else if (sizes.Length > 0 && colors.Length == 0) { String[] sizearray = sizes.Split(','); int i = 0; while (i < sizearray.Length) { //Clean Price Modifiers if (sizearray[i].ToString().IndexOf('[') != -1) { sizearray[i] = sizearray[i].ToString().Substring(0, sizearray[i].ToString().IndexOf('[') - 1); } DB.ExecuteSQL("insert Inventory(VariantID,Size,Quan) values(" + DB.SQuote(DB.RSFieldInt(rs, "VariantID").ToString()) + "," + DB.SQuote(sizearray[i].ToString()) + ",100)"); i = i + 1; } } else if (colors.Length > 0 && sizes.Length == 0) { String[] colorarray = colors.Split(','); int i = 0; while (i < colorarray.Length) { //Clean Price Modifiers if (colorarray[i].ToString().IndexOf('[') != -1) { colorarray[i] = colorarray[i].ToString().Substring(0, colorarray[i].ToString().IndexOf('[') - 1); } DB.ExecuteSQL("insert Inventory(VariantID,Color,Quan) values(" + DB.SQuote(DB.RSFieldInt(rs, "VariantID").ToString()) + "," + DB.SQuote(colorarray[i].ToString()) + ",100)"); i = i + 1; } } } rs.Close(); rs.Dispose(); }




Reply With Quote