jbisono 51 Posting Pro in Training

First you do not need this line

int result=Convert.ToInt32(cmd.ExecuteNonQuery());

, in case you need it, you do not have to convert cmd.ExecuteNonQuery() to int because already return an integer value.

Second at the end of your code add this line

dgv1.DataBind();

if that does not work, i suggest that you verify your select statement and make sure is building what you expect. for example put in comment all your code and just display your statement string in another label or text to double check is right.

Regards.

jbisono 51 Posting Pro in Training

Did you open the connection before you do the ExecuteNonQuery()?

Dim Cmd As New OleDbCommand(strSQL, Connection)
Connection.Open()
Cmd.ExecuteNonQuery()
Connection.Close()

if that does not work i would say try to pass a straightforward statement, just to make sure the statement is not wrong.

Page ispostback maybe you want to do that in page load event.

jbisono 51 Posting Pro in Training

Insted of use cmd.ExecuteReader() use cmd.ExecuteNonQuery(), ExecuteNonQuery Return an integer on how many rows were affected by that query.

jbisono 51 Posting Pro in Training

How is your code doing?

jbisono 51 Posting Pro in Training

If you want to fill the grid in the backend first import the sqlclient package

using System.Data.SqlClient;

then under the event that trigger the grid filled. do this.

SqlConnection conne = new SqlConnection("Data Source=DbServerName;Initial Catalog=DatabaseName;User ID=UserID;pwd=Password");
String statement = "SELECT tblPlayer.FirstName, tblPlayer.LastName, SUM(tblRecords.Wins), SUM(tblRecords.Losses) FROM tblPlayer CROSS JOIN tblRecords GROUP BY FirstName,LastName";
SqlDataAdapter adapt = new SqlDataAdapter(statement, conne);
DataSet ds = new DataSet();
adapt.Fill(ds);
DataGridId.DataSource = ds;
DataGridId.DataBind();

try that and let us know how you doing.

regards.

jbisono 51 Posting Pro in Training

You need to create a select statement to return all that data, Can you show table structure so we can help you to build the select. after that there are different ways to fill the grid with the data returned by the select statement.

regards.

jbisono 51 Posting Pro in Training

the model is HP G60 i tried taking out the ram and i did not hear nothing, i tried move the power cable in the jack no lucky, i guess is the motherboard then what do you guys think?

jbisono 51 Posting Pro in Training

I tried that but no good results. thanks for reply.

jbisono 51 Posting Pro in Training

My Hp Lapton wont turn on at all. i took out the battery had it plug right to the AC and nothing, just can see a little light blinking next to the AC jack. that is all.

jbisono 51 Posting Pro in Training

oops sorry about that i didn't notice that mr. ramesh post a really nice solution. anyway i think you have the point.

jbisono 51 Posting Pro in Training
private int DaysIgnoreWeekends(DateTime dtst, DateTime dtend)
        { 
            TimeSpan days = dtend.Subtract(dtst);
            int count = 0;
            for (int a = 0; a < days.Days + 1; a++)
            {
                if (dtst.DayOfWeek != DayOfWeek.Saturday && dtst.DayOfWeek != DayOfWeek.Sunday)
                {
                    count++;
                }
                dtst = dtst.AddDays(1.0);
            }
            return count;
        }

this is a little function

jbisono 51 Posting Pro in Training

oh im sorry i think i misunderstood the point. When you said this "the second highest bid that is not the same user " the same user means the person who is actually log in the system?

jbisono 51 Posting Pro in Training

Ok cool to know.

jbisono 51 Posting Pro in Training

this can give you an idea of what you need

#include <cstdlib>
#include <iostream>
void CalculateLetter(int *,int);
void PrintScores(int *, int *, int);
using namespace std;


int main(int argc, char *argv[])
{
    int CantStudent = 0;
    
    printf("Please input the number of students who took the exam:\t");
    scanf("%d",&CantStudent);
    int Scores[CantStudent];
    for(int i = 1; i <= CantStudent; i++)
    {
        printf("Please enter the score for the %d student\t", i);
        scanf("%d",&Scores[i]);
    }
    CalculateLetter(Scores,CantStudent);
    
    system("PAUSE");
    return EXIT_SUCCESS;
}

void CalculateLetter(int c[], int cant)
{
     int letter[5] = {0,0,0,0,0};
     for(int a = 1; a <= cant; a++)
     {
         if(c[a] >= 90)
         {
             letter[0] += 1;    
         } else if(c[a] >= 80)
         {
                letter[1] += 1;                
         }else if(c[a] >= 70)
         {
               letter[2] += 1;                
         }else if(c[a] >= 60)
         {
               letter[3] += 1;                
         }else
         {
              letter[4] += 1;   
         }
     } 
     PrintScores(c,letter,cant);
}
void PrintScores(int score[], int letter[], int cant)
{
     for(int i = 1; i <= cant; i++)
     {
          printf("The Student No: %d is %d\n",i,score[i]);        
     }
     printf("A=%d\n",letter[0]);   
     printf("B=%d\n",letter[1]);
     printf("C=%d\n",letter[2]);
     printf("D=%d\n",letter[3]);
     printf("E=%d\n",letter[4]);       
         
}
jbisono 51 Posting Pro in Training

try this

SELECT     TOP 1 idCustomerBid, idProduct, bidAmount, bidDate
FROM         bidHistory
WHERE     (idProduct = 272) AND (idCustomerBid <> 2) AND (idCustomerBid NOT IN
                          (SELECT     TOP 1 idCustomerBid
                            FROM          bidHistory AS bidHistory_1
                            WHERE      (idProduct = 272) AND (idCustomerBid <> 2)
                            ORDER BY bidAmount DESC))
ORDER BY bidAmount DESC

regards

jbisono 51 Posting Pro in Training

Probably this is not the best recommendation, maybe you would like to do something by you own, but if you want a reallly nice way to easy do charts, use this http://www.fusioncharts.com/free/ they explain everything how it works give it a try, i combined that software in my project in 5 minutes i was able to to charts right away. anyway if that does not work for you probably we can try something else. regards.

jbisono 51 Posting Pro in Training

well that is true @table does not have a structure to handle the insert. I guess you are using temporary tables which you can reference like this

create table #TABLE(
employeeid varchar(10),
projectid varchar(10),
num1 int,
num2 int
)
      DECLARE @SqlQuery NVARCHAR(4000);
      SET @SqlQuery='SELECT TOP '+CAST(@no_of_rows AS CHAR)+'tblEmployee.id ,
      tblProject.ID, 0,0
      FROM tblBilling (NOLOCK) '
      INSERT INTO #TABLE
      EXEC(@SqlQuery)

maybe that is what you are looking for. regards.

jbisono 51 Posting Pro in Training

hi carobee try this

DECLARE @SqlQuery NVARCHAR(4000);
    set @SqlQuery='You query here'
    INSERT into @table
    exec(@SqlQuery)

regards

jbisono 51 Posting Pro in Training

Yes, well for now im going to mark this thread as solved once the program is doing what i want, thank your very much for your help if i have another issue i will be around thanks again.

regards.

jbisono 51 Posting Pro in Training

Ok, Ramesh I think i got it, I use the link you provide to use the preinit but insted of using preinit i use prerender in that case i can execute my code from the master page in the load event in then the prerender in the content page to whatever i want in my content form. what do you think is that a good practice?.

Oh and thank you for your help.

jbisono 51 Posting Pro in Training

Ok, Thanks Ramesh, Actually with your previous comment i got it to do what i want, but the master page load event trigger after the content load event which i would like to run the content load event after the master page. if that possible?.

jbisono 51 Posting Pro in Training

Actually is something like the link you provide here, but i do not have any button to trigger this code it just run in the load page, well the thing is that piece of code is general for every single webform i have, but then maybe i would like to add some code to the specific webform. I hope you know what im saying.

jbisono 51 Posting Pro in Training

Hi, I would like to know how can I execute an event from a web content form, for example i would like to run a centralized event to assign rigths to component in every webform, but i would like to do that from the master page so i do not have to redo the same code in all web form load event.

Thanks for any help you can provide me. VS2008

jbisono 51 Posting Pro in Training

Hello all, I am looking for a Fax Software, nothing big, easy to use just fax out and in, I do not need any extra feature that a lot of fax software has.

before i had winfax pro is an old software from symantec they do not sell it anymore, anyway if somebody knows a simple software please give me the name thanks.

regards.

jbisono 51 Posting Pro in Training

I do not know if this can help you, but if you have a date field which you can order by desc, then you can use Top 1 something like this.

Select top 1 Field1
from table1
order by datefield desc

if you dont have a date maybe have a index field that is the easiest way to do that.
regards

jbisono 51 Posting Pro in Training

Got it!!! thanks for your comment.

jbisono 51 Posting Pro in Training

i see windows 7 crashing with some antivirus, in my case with endpoint protection i couldn't find a way around but install another one.

jbisono 51 Posting Pro in Training

Hi all, I just have curiosity about something that I read in a book " Unlike using the DataGrid, where you are responsible for
coding the sort routine, to enable column sorting in this grid, you just set the AllowSorting attribute to
True. The control takes care of all the sorting logic for you internally
"
and i want to make sure that work for somebody here, because i did try it and told me that the sort procedure is missing, which mean still i have to write some codes to handle the sort feature. anyway i just want to know if that is possible of course i would like to try it.

thanks all. regards.

jbisono 51 Posting Pro in Training

Well here i didn't have any trouble doing that, but anyway make sure you have windows firewall off, and run this tool and try again. Norton Removal Tool

regards.

jbisono 51 Posting Pro in Training

yes sknake you right.

jbisono 51 Posting Pro in Training

how can I always show a subreport in the second page?
thanks.

jbisono 51 Posting Pro in Training

thanks for you reply actually i fixed it, I just create a command statement with my query and i map my fields with the old ones and its working now, i guess the fact that i was working with two different datasource was the problem thanks anyway.

jbisono 51 Posting Pro in Training

The fields are DefectType, RootType in the Page Header C section and also the details section complete thanks

CrystalReport.zip

jbisono 51 Posting Pro in Training

Hello all, I created a crystal report which works perfect local but in production work partial, it means that there are 3 specific values that the report does no retrieve, is there any particular reason why this happen?.

thanks.

jbisono 51 Posting Pro in Training

I just update my server to the latest version of symantec endpoint and now everytime i log in to the server a pop up appears with this message, "A necessary file could not be loaded: ccProd" they supply an online tool to fix the problem but after i did it nothing happened.

if somebody have any idea please give a hand thanks.

jbisono 51 Posting Pro in Training

I use querystring to retrieve parameters send from another form, let's say that you are and index.html and there is a link url to default.aspx like this
~/Default.aspx?var=hello

then and the Server code from Default.aspx to retrieve that value i have this.

string stTest = Request.QueryString["var"];

now stTest is equal to "hello"
hope that help you

sknake commented: good explanation +9
serkan sendur commented: if sknake thinks it is worth it, it is worth it +7
jbisono 51 Posting Pro in Training

That means exactly what is says, probably there is a piece of code that is executed before this method and you leave the connection open. make sure you close the connection on that method. usually i forgot to close the connection if i use a data reader and then i have this problem.

jbisono 51 Posting Pro in Training

Take out the * and try it.

jbisono 51 Posting Pro in Training

Oops that is true adatapost my bad.
thanks for correcting me.

jbisono 51 Posting Pro in Training

add this at the end.
DataGridView1.DataBind()

regards

jbisono 51 Posting Pro in Training

Ok im going to try that, I let you know how it goes.

thanks

jbisono 51 Posting Pro in Training

Hi all, I have a computer that went down and i cannot load windows but i can browse the files in the hd using an enclosure, i would like to reinstall windows but i need to safe the quickbook data so i can upload that back. i do not have any backup file or online backup file for this.

I wonder if there is a way to restore the data replacing the files. thanks.

jbisono 51 Posting Pro in Training

I found what i wanted.

protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                PopulateMenu();
            }
        }
        private void PopulateMenu()
        {
            DataSet ds = GetDataSetForMenu();
            foreach (DataRow parentItem in ds.Tables["MENUOPTS_T"].Rows)
            {
                MenuItem categoryItem = new MenuItem((string)parentItem["OPTION_FNCTN"]);
               
                EntertainmentMenu.Items.Add(categoryItem);
               
                foreach (DataRow childItem in parentItem.GetChildRows("Children"))
                {
                    MenuItem childrenItem = new MenuItem((string)childItem["OPTION_DESC"]);
                    childrenItem.NavigateUrl = ((string)childItem["OPTION_LINK"]);
                    categoryItem.ChildItems.Add(childrenItem);
                }
            }
        }
        private DataSet GetDataSetForMenu()
        {
            SqlConnection myConnection = new SqlConnection("Initial Catalog=;Data Source=;UID=;PWD=;");
            SqlDataAdapter adCat = new SqlDataAdapter("SELECT DISTINCT OPTION_FNCTN FROM MENUOPTS_T", myConnection);
            SqlDataAdapter adProd = new SqlDataAdapter("SELECT * FROM EW_V_MENU", myConnection);

            DataSet ds = new DataSet();
            adCat.Fill(ds, "MENUOPTS_T");
            adProd.Fill(ds, "EW_V_MENU");
            ds.Relations.Add("Children",
               ds.Tables["MENUOPTS_T"].Columns["OPTION_FNCTN"],
               ds.Tables["EW_V_MENU"].Columns["OPTION_FNCTN"]);
            dg.DataSource = ds;
            dg.DataBind();
            return ds;
        }

Thanks all.

jbisono 51 Posting Pro in Training

Into the datagrid's headerstyle property add this

CssClass="ms-formlabel DataGridFixedHeader"
<!-- Then into the head tag create a style method like this -->
<style type="text/css">.DataGridFixedHeader { POSITION: relative; ; TOP: expression(document.getElementById("grid").scrollTop-2); BACKGROUND-COLOR: white }
</style>

grid is the ID of your datagrid.

regards.

jbisono 51 Posting Pro in Training

Why dont you include the parameters in the select statement something like

string st = "select user, pass from loggin where user = '"+txtbox1.text+"' and pass = '"+txtbox2.text+"'";
//Then pass that select to the command object
rdr=cmd.executereader();
if(rdr.HasRows)
{
   msg(" successfully loggedin");
}

Take care.

jbisono 51 Posting Pro in Training

There is a few good database language out there, but im going to keep it simple.
1) Non free license: Oracle, Sql Server, really nice interface, very user friendly and a lot support online, so you are not alone any problem i bet you can find a work around.
In the other hand for free license lovers the best one MySql, very strong database language, same thing user friendly and rich support online. php developers love MySql. whatever you select from this 3 options you will be fine.

2) I don't like the idea of creating multiples databases for the same projects, is better create as much tables you need in just one single database and take sometimes to normalize them and make the right relation between them.

3) all 3 have the most powerfull way to make any type of statement, easy maintenance, backup, restore, insert, update, delete, select, etc.. probably there is a few more but i have been working with all of them and im good with it.

take care body.

jbisono 51 Posting Pro in Training

Hi, try to add this row in the web.config <identity impersonate="true"/>

jbisono 51 Posting Pro in Training

Ok cool.

jbisono 51 Posting Pro in Training

Hi, check this thread could be helpful for you

http://www.daniweb.com/forums/thread204828.html

dpreznik commented: Thank you +1
jbisono 51 Posting Pro in Training

in your select statement are you retrieving that value? if yes verify you have autogeneratecolumns to false you have to create a bound column manually for the primary field and also you can set the visible property to false if you do not want people look at it, in the background you still can reference that column.