DataSource Controls :: How To Evaluate Nothing Value Returned By Sql Datareader In Vb.net

Aug 24, 2010

When a sql query returns NULL , I can use the following code to evaluate:

[Code]....

When a sql query returns nothing, neither IsDBNull nor is Nothing works. I don't know why some sql queries return null while some return nothing when there are no data returned. But anyway, can somebody tell me how to evaluate nothing value returned in sql datareader in vb.net? When I put the cursor over signInfo variable in debug mode, I can see Nothing show as its value. But the line does not work

[Code]....

View 3 Replies


Similar Messages:

DataSource Controls :: Cannot Evaluate Expression Error After Converting VS 2003 Web Application To VS 2008?

Jul 8, 2010

I recently converted a web application of ours to VS 2008 so that we could upgrade to .net 3.51 framework.

I have been making some changes to the layout, to take advantage of ajax and minimize the amout of data needing to be loaded and the number of postbacks processed.

The problem I am having is when I try to save the data.

The page postback calls a local Sub which reads the form data into local variables and then passes these variables to our assembly.

The primary assembly has 70 parameters which are used to populate one of the tables in our database.

So I have 70 local variables just for this call plus a variable reference to the output of the assembly which contains a property for each of the columns in the associated database record.

There are some additional assemblies called to update other tables so, in all there are 121 locally defined variables in this sub.

Bear in mind that this sub is called from the page load event which has 93 of it's own locally declared variables.

Here is what is happening, when I run the code I am using cdate() to convert the value of a text box to datetime and pass it to my assembly. When doing so it throws a conversion error.

So I created a local datetime variable and converted the value of the control to the datetime and passed the variable to the assembly.

No more error, but the proc did not save the data as it was supposed to.

What I noticed in debugging, on the locals tab, is that every local datetime variable displayed the following message:

Cannot evaluate expression because we are stopped in a place where garbage collection is impossible, possibly because the code of the current method may be optimized

I also noticed that on the watch window the same message would display if I attempted to reference any of the datetime controls on the form.

There are only 3 variables and 3 datetime controls that appear to be affected. the controls are all html input boxes. Every other variable and control on the form behaves normally and I can see their values while debugging, it is just these six that are exhibiting the problem, whats more is that they are not new controls to the form.

View 1 Replies

DataSource Controls :: Use A DataReader With SQL?

Mar 29, 2011

I have put a SQLDataSource on my page and everything is adjusted and it works properly. I read an article
here which was indicating that you can use a DataReader in order to get data from sqldatasource, but it doesn't say how, the only thing that is said is to use DataSourceMode property in order to adjust it for a DataReader.

View 1 Replies

DataSource Controls :: How To Load A DataReader

Apr 21, 2010

How do I load a datareader in a defult.aspx page using while using a database connection that is defined in the web.config file?

View 3 Replies

DataSource Controls :: Create ConnectionString Using SQL DataReader

Sep 11, 2010

why this first connection works but the second doesn't?

[Code]....

I'm trying to use <asp:FileUpload> to upload images and as far as I know you have to use <asp:SqlDataSource> to do it but I need to create the connections string using entries stored in a database.

View 2 Replies

DataSource Controls :: DataReader Telling Me It Needs To Be Closed

Jun 28, 2010

Dim sqlc1 As New SqlCommand("sp_navmenu 275,1,21", ERIKSDbCon)

View 4 Replies

DataSource Controls :: How To Convert Datareader To Dataset

May 11, 2010

Any one can suggest a method to convert Datareader to dataset or any alternate method

View 7 Replies

DataSource Controls :: DataTable With DataReader Not Working?

May 17, 2010

dataTable with dataReader not working

[Code]....

View 3 Replies

DataSource Controls :: Datareader - Loop Through Results In VB?

Feb 1, 2010

I would like to loop through my result set and generate a menu structure like this:

pagetitle
pagetitle
subtitle
subtitle
pagetitle
pagetitle

So far I have the following code but it doesn't generate the menu?

While reader.Read()
' set title
sitetitle = reader.Item("siteName")
mydata &= reader.Item("pagetitle")
' check subtitle exists, if so, build menu, loop though subtitles somehow?
if not IsDBNull(reader.Item("subtitle"))
mydata = "<ul>"
mydata &= "<li>" & reader.Item("subtitle") & "</li>"
mydata &= "</ul>"
end if
End while

Qeury and result set below:

sql:

SELECT subpages.subpageid, pages.pageid, sites.sitename, sites.siteid, pages.siteid,pages.pagetitle, subPages.subtitle FROM pages LEFT JOIN sites ON pages.siteid = sites.siteid LEFT JOIN subpages ON subpages.subpageid= pages.pageid WHERE sites.siteID = 1 ORDER BY sites.siteid, pages.pageid, subpages.subpageid ASC

results:

subpageid | pageid | siteid | siteid | pagetitle | subtitle
NULL 1 SCHS 1 1 Sandwell Community Healthcare Services NULL
NULL 2 SCHS 1 1 About Us NULL
NULL 3 SCHS 1 1 Your Services NULL
4 4 SCHS 1 1 Equality and Diversity Team at SCHS 1111
4 4 SCHS 1 1 Equality and Diversity Team at SCHS 2222
4 4 SCHS 1 1 Equality and Diversity Team at SCHS 333
4 4 SCHS 1 1 Equality and Diversity Team at SCHS 44444
NULL 5 SCHS 1 1 Single Equality Scheme NULL
NULL 6 SCHS 1 1 Diversity Strands NULL
NULL 7 SCHS 1 1 Equality Impact Assessments NULL
NULL 8 SCHS 1 1 Quality and Safety Committee NULL
NULL 9 SCHS 1 1 Contact Us NULL

View 5 Replies

DataSource Controls :: DataReader.Read() Not Working?

Mar 16, 2010

I have used SqlDataReaders a million times. Someone, what is wrong with this code:

SqlConnection connection = new SqlConnection(connectionString);
try
{
connection.Open();
SqlCommand command = connection.CreateCommand();

[Code]....

I have checked this against similar classes and it is exactly the same, but this one doesn't work.

View 4 Replies

DataSource Controls :: There Is Already An Open DataReader Associated With This Command Which Must Be Closed First.

May 27, 2010

protected void Page_Load(object sender, EventArgs e)

View 7 Replies

DataSource Controls :: Retrieve Text Field Using Datareader

Feb 25, 2010

I have text field on a sql server table and I retrieve it on string variable using datareader : string result = reader["MyTextfied"] but I have this errors ( text or binary field cannot be troncated ) My text fied contains a large of text

View 5 Replies

DataSource Controls :: Manage A Datareader With Data Field?

Mar 25, 2010

i have a datareader who read from data field from sql server, this field is datetime format now, when this field is null it returns 01/01/1900!! how can i manage it without if or some check, is there a property in datareader or sqlserver properties who i can return null value from datetime field?

View 4 Replies

DataSource Controls :: Almost 2 Seconds To Read A Datareader Field

Apr 16, 2010

I use a SqlDataReader to get fron sqlServer a row af a table. This table have a text field where I store a Xml configuration. In one case this Xml grow up to 650Kb. When I get the field from the datareader it cost amost 2 seconds:

INFO 2010-04-16 09:46:40,559 [12] Cms.dataContenido - readed
INFO 2010-04-16 09:46:42,356 [12] Cms.dataContenido - XMLContent

This is my code:

[Code]....

View 1 Replies

DataSource Controls :: Reading With DataReader Into List And OutOfMemoryException

Sep 23, 2010

I'm Using a DataReader to Read about 100,000 records, my code look like :

[Code]....

I have a per row computation in reading the rows on GetMyType2Info() method, and this method also another method that I return only one record by ExecuteReader(). the problem is that when the MyTypeList (List<T>) has about 21,000 Items of MyType (<T>) System.OutOfMemoryException is thrown. wanted to know how to resolve this and wanted to know more about the maximum size of List<T> capacity. in addition the execution of the main Query with 100,000 records take about 4 seconds in SQLServer a record has only types of nvarchar , float,datetime and int

View 1 Replies

DataSource Controls :: ODBC Datareader Is Not Working With DB2 Some Tables?

Jun 2, 2010

This is the code i am used for fetching data from DB2 server (windows based server)In the same server tables created by me is working fine...eg:

oCommand.CommandText = "SELECT * from DEB.TESTUSER";

below is a table created by another application but the data reader is not working with this query ( table in the same server with same DB as above)

oCommand.CommandText = "SELECT * FROM DEB.RULE_GROUP";

If any permission or any other things i want to check .....i mean security related.....odbcadapter is also working fine....pls help regarding the datareader.....below is the complete code......

private void btnSelectRecord_Click(object sender, EventArgs e)
{
OdbcConnection oConnection = null;

[code]...

View 3 Replies

DataSource Controls :: Can Subquery Returned More Than One Value

May 5, 2010

have 2 tables in SQL 2000 developer edition identicals, Prereception and eceptions, on the table Recepcions I have the following trigger:

CREATE TRIGGER [AumentaInventario] ON dbo.Recepcion
FOR INSERT
AS
declare @Codigo nvarchar (50)
,@Cantidad int
[code]...

View 2 Replies

DataSource Controls :: Subquery Returned More Than 1 Value?

Feb 16, 2011

im working on visual Studio 2010, and i have an error on an update.

this is the code in VB.

[Code]....

Thats the code and the error is:

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.`

View 4 Replies

DataSource Controls :: Getting A Single Value From A Returned Dataset?

Feb 18, 2010

I've managed to connect to the database and return a record based upon a login name. I can itterate through the rows printing out the password but I know there's only 1 row (or can test for that) so how do I get the value of the password for the one row without the loop?

Dim supervisorAdapter As New SupervisorTableAdapters.SupervisorTableAdapter
Dim supervisors As Supervisor.SupervisorDataTable
supervisors = supervisorAdapter.GetSupervisorByLogin(login)
For Each count As Supervisor.SupervisorRow In supervisors
Response.Write(count.password)
Next

View 3 Replies

DataSource Controls :: Count Items Returned From ObjectDataSource?

May 27, 2010

I am viewing items returned from a dataset in an Infragistics chart control. My problem is that due to a weak point in the control, I am left looking for a way to manipulate the height of the chart based on the count/number of items returned by the ObjectDataSource(DataSet).

Does anyone one have an existing C# sample they could let me view of accessing the count of records returned within the code-behind of a page that I could then use within a case statement to set the hight of the control?

View 7 Replies

DataSource Controls :: NULL Value Returned From Database And Handling It

Feb 14, 2010

I'm developing a website using asp.net 2.0 . I have retrieved a record from database through the query.

SqlConnection con = new SqlConnection(connectionstring);
con.Open();
String SQL = "SELECT * FROM Table where attribute1 = value";
SqlCommand cmd = new SqlCommand(SQL, con);
SqlDataReader reader = cmd.ExecuteReader();

Sometimes, there is no record matching this query and so null value is retrieved. My question is how to find that the null value is returned. Since If (no record found i.e NULL) certain actions needs to be done and if (records found i.e NOT NULL) ceratin different actions needs to be carried out.

View 10 Replies

DataSource Controls :: How Do Access The DataSet Returned By A SqlDataSource

Feb 17, 2011

I want to run a SUM on a particular against the DataSet returned by a SqlDataSource. How can I access the DataSet stored in memory that is returned by the SqlDataSource to run this calculation?

View 2 Replies

DataSource Controls :: Access Data Returned In Dataset?

Feb 26, 2010

I am having some difficulties with a particular task. I am creating a support desk intranet application and I am trying to write a method within a class within a namespace which will form a generic database connection which can be called from any of the aspx pages so that I have the dbconnection logic in one place; you know, going along with the 'DRY' (Don't Repeat Yourself) mantra.

The Namespace:

SUPPORTDESK.SQL.dbconnection.pullData()

Objective of the method:

To provide any aspx code behind file with an SQL Server 2005 Express Connection and if possible return the data from an SQL Query. This is where I need advice do I create the method such that it simply forms the connection and returns a DataSet or that it returns an SQLConnection object? If i've got things back to front and upside down don't worry I'm a beginner with ASP.NET. The Method so far:

[Code]....

If I'm on the right track how do I access the data returned in the DataSet?

View 3 Replies

DataSource Controls :: Run A Sql Stored Procedure And Access The Returned Value?

Mar 30, 2010

I have a stored procedure 'RoomIfExists' on my sql server (it does work). It takes a string variable for the Room_No and returns either '1' or '2' depending on the result of the query.

[Code]....

I need to know how to run the sp in c#, passing the variable Room_No and then pull the result from it.I am using a data reader.

View 2 Replies

DataSource Controls :: Linq Group Cannot Get The Data Returned

Feb 8, 2010

I'm attempting to further reduce a dataset/table by various user input. Part of this process is grouping the data by a timestamp prior to a summation. I'm trying to use LINQ and cannot get the data returned that I need.

[Code]....

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved