padtes 30 Junior Poster in Training

it looks like you got onclick handled. This should be submitting to the same page. I was suggesting more like following:
1. Under <head> add following javascript function:

function callPage(Rowkey) {
  alert ('debug: key=' + Rowkey);
  window.location = "yourOtherPage.aspx?key=' + Rowkey;
}

2. In your current code, replace onClick part as following:

e.Item.Attributes.Add("OnClick", "javascript:callPage ('" + your_key_as_per_row + "')");

The way I have used it is in my project is one cell itself is href. You seem to be doing the whole row clickable. If your alert works, there is hope. As you would notice, "your_key_as_per_row" is your business logic, not just row number (it could be row number if logically that is sufficient).

Here is actual sample code from my project

hlnk.Attributes.Add("OnClick", "OpenWeekRpt('Reports/TestDDL.aspx?showMenu=N&periodID=" + ddlPeriod.SelectedValue
                + "&metCode=" + dr["metricsID"].ToString() + "&SRcode=" +ddlCountryRel.SelectedValue+ "')");

Here hlink is one cell.

As you would notice, there are number of things being passed in the URL (string), the URL is parameter to javascript function: OpenWeekRpt.

Hope this helps.

Traicey commented: Thanks man +2
padtes 30 Junior Poster in Training

Is there a chance of using hyper link? One or all your columns could be hyperlinks and the link itself would be something like

<a href='newWebForm.aspx?key=' <%= bind-key %>'>your column data</a>

Other is, since you are handling color change to show current selected row, you are already handling atleast one mouse event. Same way, you can handle click event in JavaScript. I guess I am missing something; don't know what.

Let us know your solution when you close the thread.

padtes 30 Junior Poster in Training

Check if there is divide by zero because TextBox3.Text is blank or 0.

Write you if upfront for that.

In addition, simple int might not be large enough, but that doesn't seem to be the current error.

please mark thread closed if this helps. Otherwise post your solution if any.

padtes 30 Junior Poster in Training

first doc it to say right hand side by pulling the dialog title bar (here the blue bar that says Solution Explorer), click and hold and drag to one side where there will be an arrow like image will appear once you do this. Or double click on the title bar.
After it is docked, there will minimize like little trangle, a push-pin next to it and x to close window. When the pushpin is pointing side ways, it is stuck "open", when the pin points down it is auto-hide. To toggle the the modes, click on the pin.
Please close the thread if this is what you needed.

padtes 30 Junior Poster in Training

Assuming you want order by date (SQL server 2005 or higher)

select row_number() over (order by [date]) as serNo, * from (
SELECT [date], SUM(Qty) AS Qty, FROM mytable GROUP BY [Date] ) t

For SQL 2000, stored proc with temp table with auto increment column

create table #tmp (sNo int identity(1,1), dt dateTime, qty numeric(12,2) )
insert into #tmp (dt, qty) SELECT [date], SUM(Qty) AS Qty, FROM mytable GROUP BY [Date] 
select * from #tmp 
drop table #tmp

please mark as solved if this helps. If you get other solution, post it here.

padtes 30 Junior Poster in Training

I am not sure how you are loading the dataset that has previously purchased products for the customer. Can you pass that customer ID as parameter and re-query that in you query and use something like ShopCartItem.ProductID not in (select ProductID from pastPurchase where custID=@custID) May be there are more paramters like promotion ID or date etc.

Other option is (a little ugly) is to use a string for whole query and not in will take whole comma seperated product ID string.
for ex.

string sql = "select ... from " 
  + " and productID not in (" + previousProdCSV + ")";

//.executeNonquery(sql)

or same can be passed as param to MS sql query and use exec(@sql) in same fashion.

padtes 30 Junior Poster in Training

try this

int returnVal = 0;
 if (rdr[0] != DBNull.Value) {
   returnVal = Convert.ToInt32(rdr[0]);
}

I wonder how VS did not give you auto suggestion for this.

padtes 30 Junior Poster in Training

Would you rather subtract 52 weeks from your @LastBusinessDay? Because, even if today was Wed Jan 13 2010, Last year Jan 13 is Tue. select dateadd(wk, -52, getDate()) See if this is better? If it helps lets close this thread.

padtes 30 Junior Poster in Training

I would personally prefer a console application, not windows application. If you have main logic code extracted outside of form, you can easily put together a console app.

However I do expect WinForm to have .visible = False possible. Problem is on what event of the form are you expecting your code to run? May be form load?

padtes 30 Junior Poster in Training

If this is stored proc, it is sure simple.

SET @returnValue = 0
    SELECT @returnValue = 1, item FROM TABLE
-- @returnValue = 1 means there were records in the table

if you want this as part of one query, I would like to know how you are using the query? For ex. in c#, or VB or ASP etc. In that case, you can look for record count returned (zero or more).
Hope this helps. If helps, close the thread. Thanks.

padtes 30 Junior Poster in Training

Database cannot really force this (nothing simple or standard way); your programming logic should take care of this by not allowing add sea not possible unless there is country, edit sea record invalid if no country relation is given by user.
As far as database is concerned, this is good.

padtes 30 Junior Poster in Training

I feel current structure is enough, if a country has no sea-border, there will be no record in SEA_BORDER for that country. As far as database is concerned your current structure is perfect.

When finding countries with/without border with sea etc, you need to write correct SQLs (selecs).

padtes 30 Junior Poster in Training

In ASP.net I know of is

lstPlace.selectedValue=yourValue;

as well as

lstPlace.selectedIndex=yourIndex;

depending upon your requirement will select a particular entry in the drop down list.
Note that C# is case sensitive and my code above might be incorrect for that reason.

As far as hashtable goes, you will need different keys, in your example you are using only "0".

You can have data sources such as datatable or arraylist or dataset. In case of arraylist, the objects in the arraylist at runtime, need the public properties named as your strings in DataTextField / DataValueField.

In case of table, the DataTextField/DataValueField column names.

Please close thread if this helps.

padtes 30 Junior Poster in Training
cmd.Parameters.AddWithValue(IIf(Val(Me.TxtCod) = 0, "Null", "@code", Val(Me.TxtCod)))

Note that IIF takes 3 parameters, adjust parenthesis of that.

cmd.Parameters.AddWithValue("@code", IIf(Val(Me.TxtCod) = 0, "Null", Val(Me.TxtCod)))

Please mark trhread closed if this helps.

padtes 30 Junior Poster in Training

You are having

MsgBox(ssql)

Can you seen that query and run directly? Or through debugger, set a break point and get value of ssql and post it?

Do you have single quotes as part of data? Does it always fail? Id passwrd a valid table, and other 2 columns Ok?

padtes 30 Junior Poster in Training
UPDATE Table1 
SET comment = isnull((select comment FROM Table1 y WHERE y.Idx=1234 and table1.vin = y.vin),comment),
author = isnull((select author FROM Table1 y WHERE y.Idx=1234 and table1.vin = y.vin), author)
WHERE vin like '%WLS%'

Check the logic, test. Close thread if this solves it.

padtes 30 Junior Poster in Training

I don't have solution; but I observed @docname parameter is created but not added to cmd.Parameters collection. I would expect error but different one.
please mark thread solved if this helps

padtes 30 Junior Poster in Training

I used frames, though it is not a prefered solution; but is sure simple and guaranteed to work.

padtes 30 Junior Poster in Training

When you say data is updated in the database, you mean you have handled the page postback correctly.
Also you are saying the datalist is filled correctly when page is refreshed, that means, the datalist filling code is there and working AND the datalist depends on your latest update.
All you have to do is, logically, after updating database, fill the datalist and bind again. One of the standard practices is: add private method that will fill datalist. Call it on page load when not postback as well as call after database update.
If this helps, please mark thread as solved.

padtes 30 Junior Poster in Training

When you scream for help, shouldn't you put your solution when you find one?

padtes 30 Junior Poster in Training
select MakeName + '(' + cast((select count(*) from CarSale p where p.MakePK = m.PK) as varchar) + ')' dispField, m.PK
 from CarMake m

For MS SQL 2000 above code, assumes PK as primary key for join of CarSale and CarMake. Also assuming that you will need the PK as value member.
- PadteS

Acutually im populating DDL from one table(CarMake) and counting no. of records from another table(CarSale) means how many cars are there for sale of a certain CarMake.

padtes 30 Junior Poster in Training

It is more like logic problem than technology problem. Note that paint method is called everytime there is change in the Graphics. It is beyond your code's control. Which means every time something happens (like re-size / hide-unhide), Graphics gets refreshed, calling paint method.
Now you are drawing (fillOval) all the time, using the same size1, size2 variables. What you need is another class (structure) to save all the info that is related to a specific part of drawing, like points, line thickness, color etc. And your main drawing will be collection (like an Arraylist) of these structures. Your paint will use these instances paint.
Hope this gives you some direction to think.