Jump to content
Xtreme .Net Talk

TheMagician

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by TheMagician

  1. Hey guys I have set up an intranet site with a Poll on it. Everything works fine and it records the votes in a database and that all works fine as well. The problem is I want to restrict people to only voting once. Log-in isn't an option, but I am using cookies to identify those that have voted when they open the page afresh. However the loophole is that if you vote and then press back on the browser, you can then vote again. I really don't know how to stop this happening? Is it possible to capture the "back" event? How else could this be managed? Any ideas would be muchly appreciated :) Cheers Ian EDIT: I'm using ASP.net with vb.net code behind.
  2. Hi I have an asp.net webform which has a datagrid and a few other controls. I'm writing the code behind in vb.net I currently have a dataset that returns: Column1__Column2___Value __A____.___X____.___10 __A____.___Y____.___20 __B____.___X____.___30 __B____.___Z____.___40 __C____.___Y____.___50 __C____.___Z____.___60 Which I can get to display perfectly well on a datagrid. What I want to display on the page is the matrix form of this data, ie in this case: ____A__.__B__._C X__10__._30__._ 0 Y__20__._ 0__._50 Z__ 0__._40__._60 I have a few ideas but they all involve manually getting a list of the ABCs and XYZs, then manually iterating through the dataset to populate the datagrid or array with the matrix. This seems a little unweildy - has anyone got a better way of approaching this? (given the actual data may be returning as many as 35,000 records in the initial dataset, and the columns are going to be any two from a list of 7). Many thanks for any ideas :) Cheers TM
  3. Hi all I have a datatable that essentially works like this (containing numbers): Title |Column1|Column 2|...... |Column n|TOTAL| Name 1 Name 2 .... Name n TOTAL (ie it is essentially a 2D array with totals) I want to remove each row that has a value in the total column of zero, and then remove each column that has a value in the total row of zero. (or vice versa - its irrelevant) I think this is an example where an enumerator is a good idea (correct me if I am wrong) but I am unsure how to implement it. Simply iterating through the rows causes errors because when you remove one the index numbers and row/column count change and obviously it throws exceptions. Any advice would be very much appreciated. Cheers TheMagician
  4. I figured out the problem - it was in the database structure itself - someone helpfully renamed the table names and inserted a new relationship between two existing ones without telling me! (dont you hate shared drives!) Thanks for looking at it though!
  5. Hi I have some code for accessing a MS Access 2000 database. The code returns the error "No value given for one or more required parameters." when the line MyAdapter.Fill(dsGrid) is executed. I know the adapter/connection work because it works on other queries in the same programme and it is identical (except for the SQL) so the connection string is correct. I therefore conclude the SQL is the problem but I thought the SQL was right because I have taken the strSQL value (which it outputs to a label at the end) and pasted it into Access and (after replacing the % with *) it produced the correct values within Access. Any help would be greatly appreciated!!!! Cheers Ian Private Sub PopDataGrid() Dim strSQL, strDim1, strDim2, strFilter, strFilterCriteria, strDisp As String Dim strTab = "[National DB 2001-02]" 'Main filter strFilter = cboFilter.SelectedValue If optDetail.Checked Then strFilterCriteria = cboFilterChoice.SelectedValue Else strFilterCriteria = "" End If 'Dimensions strDim1 = cboDim1.SelectedValue strDim2 = cboDim2.SelectedValue 'Display strDisp = cboDisplay.SelectedValue 'Generate(SQL) 'Select strSQL &= "SELECT " & strDim1 & "." & strDim1 & "_Name, " strSQL &= strDim2 & "." & strDim2 & "_Name, " & strTab & "." & strDisp ' From strSQL &= " FROM " & strFilter & " INNER JOIN (" & strDim1 strSQL &= " INNER JOIN (" & strDim2 & " INNER JOIN " & strTab strSQL &= " ON " & strDim2 & "." & strDim2 & "_Id = " & strTab & "." & strDim2 & ")" strSQL &= " ON " & strDim1 & "." & strDim1 & "_Id = " & strTab & "." & strDim1 & ")" strSQL &= " ON " & strFilter & "." & strFilter & "_Id = " & strTab & "." & strFilter ' Where strSQL &= " WHERE " & strFilter & "." & strFilter & "_Name LIKE '%" & strFilterCriteria & "%';" Dim MyConnection As New OleDbConnection("provider=Microsoft.Jet.Oledb.4.0; data source=" & strPath) Dim MyAdapter As New OleDbDataAdapter(strSQL, MyConnection) Dim dsGrid As New DataSet Try MyAdapter.Fill(dsGrid) MyDataGrid.DataSource = dsGrid MyDataGrid.DataBind() Catch ex As Exception lblError.Text = ex.Message Finally MyConnection.Close() End Try lblMsg.Text = strSQL End Sub
  6. Hi all After some extensive searching, reading forums, and a whole lot of frustration - i put the plea out to this forum I learnt my VB in VB6 and had fairly well sorted out the whole ado thing and could open access databases and do all the funky sql stuff, and was happy. Along comes vb.net, which in so many ways is very kewl. However, i CANNOT figure out how to do what i used to do with ado under the new ado.net framework (ie i'm not really even sure how to start - ie should i create a oledbconnection thing or do that programmtically etc) Theres tutorials galore that show me how to do it with SQLServer but as for MS Access, I have no idea. Basically what I want to do is to (however is best) get access to the different data in an MS Access Database (ie .mdb file) via SQL commands, and be able to use that to display on a form. Can someone either direct me to a simple, well explained example on this, or even better! show me how! Any help would be tremendously appreciated Cheers, TheMagician
×
×
  • Create New...