ASP.NET - VB Problem

Asked By Chempaka Sari
06-Sep-10 01:48 AM
hye there...

this code did not give me any output. please help me

Imports system.data
Imports system.data.oledb
Imports System.data.SqlClient
Imports System.data.SqlClient.SqlDataReader
 
 
Partial Class testALert
  Inherits System.Web.UI.Page
  Dim con As New OleDb.OleDbConnection
  Dim dbProvider As String
  Dim dbSource As String
  Dim detReport As OleDbCommand
  Dim drRef As OleDbDataReader
  Dim dg As DataGrid
  Dim resultDSO As Double
 
  Private Sub Detailreport_Click()
 
    dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
    dbSource = "Data Source = C:\Users\MC-dy\Desktop\CSGFunctionalitiesMadiNyerPart\DoItTryIt\CSG1.2.mdb"
 
    con.ConnectionString = dbProvider & dbSource
 
    Try
 
      con.Open()
 
      detReport = New OleDbCommand("select r.StockLongName, r.StockCode, r.Board, r.Sector, r.SubSector, r.FYE, q.MarketCapLocal FROM referential r inner join quarter q on r.stockcode = q.stockcode", con)
 
      'Select Referential.StockCode, Referential.StockLongName,Quarter.TotalCurrentAsset, Quarter.CurrentLiabilities, Format(Quarter.TotalCurrentAssets / Quarter.CurrentLiabilities, "\0.00"\)AS CurrentRatio From Referential INNER JOIN Quarter ON Referential.StockCode = Quarter.StockCode WHERE(Quarter.CurrentLiabilities <> \""\;\
      drRef = detReport.ExecuteReader()
 
      GridView1.DataSource = drRef
      GridView1.DataBind()
 
      con.Close()
 
    Catch ex As Exception
      MsgBox("cannot open connection")
    End Try
 
 
  End Sub
 
End Class

  Anand Malli replied to Chempaka Sari
06-Sep-10 01:56 AM
Hi Sambal,

your code looks ok to me,what i will advice you to check is in your db it may happen that there no entry for the stock for particular quarter with for stockcode,so what happens is no rows are coming in output and so your grid is not getting bind

can you just check that??? or just try binding your grid first with only single query to check your code is working

ping me with update
THXS
  Web Star replied to Chempaka Sari
06-Sep-10 02:04 AM

code looks like ok only you need to check your query and make sure that query retrun values means the value should be exists in table on that condition

you also see this is working code

private void ReadRecords()
{
  OleDbConnection conn = null;
  OleDbDataReader reader = null;
  try
  {
    conn = new OleDbConnection(
      "Provider=Microsoft.Jet.OLEDB.4.0; " +
      "Data Source=" + Server.MapPath("Pets/Pets.mdb"));
    conn.Open();

    OleDbCommand cmd =
      new OleDbCommand("Select * FROM PetTable", conn);
    reader = cmd.ExecuteReader();

    datagrid.DataSource = reader;
    datagrid.DataBind();
}
//    catch (Exception e)
//    {
//      Response.Write(e.Message);
//      Response.End();
//    }
  finally
  {
    if (reader != null)  reader.Close();
    if (conn != null)  conn.Close();
  }
}

  Chempaka Sari replied to Web Star
06-Sep-10 02:40 AM
okeyh...thnk you so much to all..im still work on it!
Create New Account
help
Net hi friends Any one send frequently asked Important questions in C# .Net, ADO .Net, Asp .Net and Sql Server. . . . . . . . tx in Advance. . . . . . Hi, Find this. . (B)What is an IL? (B types? (B) What is concept of Boxing and Unboxing ? (B) What is the difference between VB.NET and C#? (I) what is the difference between System exceptions and Application exceptions? (I A) What is scavenging? (B) What are different types of caching using cache object of ASP.NET? (B) How can you cache different version of same page using ASP.NET cache object? (A) How will implement Page Fragment Caching? (B) Can you compare ASP.NET sessions with classic ASP? (B) Which are the various modes of storing ASP.NET
with indexers, destructors, or types. In C#, the static keyword indicates a class variable. In VB, the equivalent keyword is Shared. Its scoped to the class in which it occurs. Example 40; sqlDa1.Fill(ds1); dg1.DataSource = ds1; dg1.DataBind(); Answer2 Yes Dim cn as new OleDbConnection ( “Provider = Microsoft.Jet.OLEDB.4.0;”+ _ “Data Source = C: \ Documents and Settings \ User \ My Studio Projects \ 1209 \ db1.mdb”+ _ “User ID = Admin;”+ _ “Password = ;”); Dim cmd As New OleDbCommand(”Products”, cn) cmd.CommandType = CommandType.StoredProcedure Dim da As New OleDataAdapter(cmd) Dim ds As is assumed. Answer2 8000 Answer3 The business logic is the aspx.cs or the aspx.vb where the code is being written. The presentation logic is done with .aspx extention. How in Sql server as var_name int How do you separate business logic while creating an ASP.NET application? There are two level of asp.net debugging 1. Page level debugging For this we have to edit the page level debugging
Migration from ASP to ASP.net How to convert ASP site to ASP.NET site using C# http: / / www.asp.net / downloads / archived-v11 / migration-assistants / asp-to-aspnet hi, ASP.NET framework is very much different from unstrucured ASP and there is no correct way to
in web how to session useful in web plz send me details with code in vb best benifit of the session is user based mean u can differentiate login user in different way • Process independent. ASP.NET session state is able to run in a separate process from the ASP.NET host process. If session state is in a separate process, the ASP.NET process can come and go while the session state process remains available. Of course, you ASP, too. • Support for server farm configurations. By moving to an out-of-process model, ASP.NET also solves the server farm problem. The new out-of-process model allows all
Tracing in ASP.NET? hi all, what is tracing? how to achieve tracing in asp.net? different ways of doing tracing? thanks and regards Aman Khan hi. . Tracing in ASP.NET 2.0 Tracing is a way to monitor the execution of your ASP.NET application. You can record exception details and program flow in a way that doesn't