kkunodziya 0 Newbie Poster

How about converting the date to varchar(11) and then pass it as varchar.
like so:

When Grouping(Month(A.InitDate)) = 1 Then ' ' else isnull(Convert(varchar(11),A.InitDate,106),' ') End As 'InitDate'
---an empty string should be returned incase of a null.

kkunodziya 0 Newbie Poster

--ok. Continue from there. Then you will need to use the function Month(date) in your query. The value 'Date' in your query, might cause an error since it won't be same data type as date, unless you have your InitDate as varchar.

Try the following :

SELECT CASE
When Grouping(Month(A.InitDate)) = 1 THEN ''
else A.InitDate End As 'InitDate'
,Sum(A.total) As InitCount, Sum(ISNULL(B.total,0)) As TransCount from CTE A
left outer Join CTE2 B on A.InitDate = B.TransDate
group by Month(A.InitDate),A.InitDate with rollup

kkunodziya 0 Newbie Poster

In your CTE columns you have a column named InitDate but in the selected columns you have the column as InqDate. Same applies to CE2 you have a column named Transdate and yet in your select statement you have it as InqDate. You might need to begin by fixing that part.

kkunodziya 0 Newbie Poster

The tricky part is how he stored the image in the database. Did he save the url to the image or did he save the actual image as data type Image in the database. If second scenario, then he would need to create another page lets just call it ImageWrite.aspx . in the form load of that page he would have to write the logic for writing the image using Response.BinaryWrite(image);, i mean after retrieving from the database. Now he can assign the url of the page as the image source to the ImageField of the GridView.

kkunodziya 0 Newbie Poster

'It is probably because you are adding your parameters within a for loop. In that case 'only the first line will be updated without an error, i.e when i=0. but when i=1, you 'are going to be having 12 parameters for your cmd, and so on and so on.

'try something like:

Private Sub Updatetable(Mitem Integer, MUom As Integer, Mgroup As Integer, Morqty As Integer, Mavgcons As Integer, Mreorder As Integer)
        conn = New SqlConnection(frmstlogin.Constr)
        conn.Open()
        cmd = New SqlCommand(cmdstr, conn)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = "Updatedata"

            cmd.Parameters.AddWithValue("@Item", Mitem)
            cmd.Parameters.AddWithValue("@Uom", MUom)
            cmd.Parameters.AddWithValue("@Group", Mgroup)
            cmd.Parameters.AddWithValue("@orqty", Morqty)
            cmd.Parameters.AddWithValue("@Avgcons", Mavgcons)
            cmd.Parameters.AddWithValue("@Reorder", Mreorder)
            cmd.ExecuteNonQuery()

    End Sub

    'You then call your sub in some event e.g button click like

    For i = 0 To Dgvitem.Rows.Count - 2

    Updatetable(Dgvitem.Item(1, i).Value, Dgvitem.Item(2, i).Value, Dgvitem.Item(3, i).Value, Dgvitem.Item(4, i).Value, Dgvitem.Item(5, i).Value, Dgvitem.Item(6, i).Value)

    Next
kkunodziya 0 Newbie Poster

You don't have to be lazy. Thats the best practice, Thats the demand of coding. You would need to create 2 tables, one for the city and another for the country. You obviously need to link up the 2 tables by having the primary key of country table as a forein key in the city table.

after that you want to bind your country drop down with the data from country and you also want to enable the autopostback property of your drop down.
you will then have to bind data on the city drop down in the index changed event of the country drop down. Makes sense?

kkunodziya 0 Newbie Poster
           //put a FileUpload control on your form and the try the code below.

           private Boolean UploadFile
            {
            Boolean valid = true;
            string ext;
            string fileName;
            if (fileUpload.PostedFile.ContentLength ==0)
            {
                valid = false;

                lblFeedBack.Text = "Browse file";
                 return valid;
            }
            else
            {
                ext = System.IO.Path.GetExtension(fileUpload.PostedFile.FileName);
                fileName = System.IO.Path.GetFileName(fileUpload.PostedFile.FileName);

                string filePath = "";

                if (ext == ".jpg")
                    valid = true;
                else if (ext == ".bmp")
                    valid = true;
                else if (ext == ".gif")
                    valid = true;
                else if (ext == ".png")
                    valid = true;
                else
                {
                    valid = false;
                    lblFeedBack.Text = "Only gif, bmp,jpg or png format files supported.";
                    return valid;
                }
                filePath = Server.MapPath("FileFolder");
                filePath += "\\" + fileName;
                fileUpload.PostedFile.SaveAs(filePath);

            return valid;
            }
kkunodziya 0 Newbie Poster

//Put a FileUpload control on your form.
//and then try something like below.

             private Boolean UploadFile
             {
             Boolean valid = true;
             string ext;
             string fileName;
            ext = System.IO.Path.GetExtension(fileUpload.PostedFile.FileName);
            fileName = System.IO.Path.GetFileName(fileUpload.PostedFile.FileName);

            string filePath = "";

            if (ext == ".jpg")
                valid = true;
            else if (ext == ".bmp")
                valid = true;
            else if (ext == ".gif")
                valid = true;
            else if (ext == ".png")
                valid = true;
            else
            {
             valid = false;
             lblFeedBack.Text = "Only gif, bmp,jpg or png format files supported.";

             return valid;
            }
            filePath = Server.MapPath("FileFolder");
            filePath += "\\" + fileName;
            fileUpload.PostedFile.SaveAs(filePath);
            return valid;
            }