ASP.NET - Err Qry

Asked By Rahul
09-Feb-12 11:31 PM

Err Qry:

int c = ds.Tables[0].Rows[m]["cid"].int.Parse;

  Sreekumar P replied to Rahul
09-Feb-12 11:37 PM
Hi,

Here is some perfect coding...

if(ds!=null)
      {
        if(ds.Tables.Count>0)
        {
          if(ds.Tables[0].Rows.Count>0)
          {
            int c;
            if(ds.Tables[0].Rows[m]["cid"]!=DBNull.Value)
              c=0;
            else
               c =Convert.ToInt32(ds.Tables[0].Rows[m]["cid"]);
          }
        }
      }
  Danasegarane Arunachalam replied to Rahul
09-Feb-12 11:45 PM
You can also us the As operator in C#

int c = ds.Tables[0].Rows[m]["cid"] as int;


If there any values in the cid column then it will converted into integer. If the value is null then it will be converted as "0" which is the default value for int
  D Company replied to Rahul
10-Feb-12 12:09 AM
Maddy,

Your parsing is wrong thats why u get error because parse method takes a string, and the data comes back as a simple object, follow this way.

Convert.ToInt32(dt.Rows[0][0]); 
int c = Convert.ToInt32(ds.Tables[0].Rows[m]["cid"].ToString());

or

int c = Convert.ToInt32(ds.Tables[0].Rows[m]["cid]);

Hope it helps!!
Regards
D

  Rahul replied to Rahul
10-Feb-12 02:53 AM
this is correct qry:

total = float.Parse(dr[0].ToString());

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 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 session
single table in ADO In contrast, a dataset is a collection of one or more tables in ADO.net ADO is designed primarily for connected access ADO.net the disconnected access packet size = 4096?; String strCom1 = ”SELECT * FROM employee”; SqlDataAdapter sqlDa1 = new SqlDataAdapter(strCom1, strCon); ds1.Tables.Add(”employee”); sqlDa1.Fill(ds1, 40, 50, ds1.Tables[”employee”].TableName); DataGrid dg1.DataSource = ds1.Tables[”employee”].DefaultView; dg1.DataBind(); Answer2 OleDbConnection1.Open() OleDbDataAdapter1.Fill(DataSet21, 5, 15, “tab”) This will New OleDataAdapter(cmd) Dim ds As New DataSet() da.Fill(ds, “Products”) DataGrid1.DataSource = ds.Tables(”Products”) What is the maximum length of a varchar in SQL Server? Answer1 VARCHAR[(n 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
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
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
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 servers