.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

SQL query gives results, but Visual Studio doesn't

Posted By:      Posted Date: October 01, 2010    Points: 0   Category :ASP.Net


I have problem accessing data from SQL query in ASP.net. I checked the query and it returns two fields, both with data, but when I run the same query in Visual Studio I get the following error: "Invalid attempt to read data when no data is present."

The problem is that data does exist...

This is what SQL query returns when executed on SQL Server Management Studio (I bolded the different header so you can see the difference):

url idClanak
Upload/Default2.png 8
Upload/Default3.png 8
Upload/Catrinel Menghia 7.jpg 8

The following is the ASP.net code (I bolded the piece of the code that apparently has some problems):

    private void Upisivanje(int idClanak, string naslov, string datumString, string kategorija, string autor, string slika, string opisSlike, string sadrzaj)
        string facebook = "<a href='http://www.facebook.com/sharer.php?u=" + Request.RawUrl + "&t=" + naslov + "'><img src='Images/Facebook.png'/></a>";
        string twitter = "<a href='http://twitter.com/home?status=" + naslov + " na: " + Request.RawUrl + "'><img src='Images/Twitter.png'/></a>

View Complete Post

More Related Resource Links

VISUAL BASIC: Unleash The Power Of Query In Visual Studio "Orcas"


LINQ, coming in the next version Visual Studio, codename "Orcas", adds type-safe data querying to .NET languages.

Ting Liang and Kit George

MSDN Magazine June 2007

Share The Load: Report Visual Studio Team System Load Test Results Via A Configurable Web Site


This article discusses a new load test tool in Visual Studio 2005 Team System for performance and stress testing your Web sites, Web services, and other server components. Combined with its handy reporting capabilities, the load test tool provides some powerful options for sharing and managing test results.

Wen Ding

MSDN Magazine June 2006

Visual Studio doesn't build with InternalsVisibleTo if using a CodeActivity within the same assembl


I have unit test projects to test some workflows. So I have some InternalVisiblesTo in my main project so my test project can call them. But when I do workflows (.xaml) in the test project using some codeactivity also defined into the test projects, the build doesn't see the InternalVisiblesTo attribute and I get errors like this one :

Error 1 'BugVSInternalVisiblesTo.Class1' ne contient pas de définition pour 'Method1' c:\Projects\BugVSInternalVisiblesTo\ActivityLibrary1\CodeActivity1.cs 9 41 ActivityLibrary1

Here are the steps to reproduce easily my case :

1- Create a C# Class Library project with this code :

using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo ("ActivityLibrary1")]

namespace BugVSInternalVisiblesTo
  public static class Class1
   internal static void Method1 ()

2 : Create a new C# Workflow ActivityLibrary project named "ActivityLibra

Why doesn't Visual Studio support MSIL as a first class language?


I'm dissapointed that Visual Studio (I'm running VS 2008) doesn't support IL as a project language, so that we can select it when starting a new project. We could then edit/assemble in VS and build debug test etc just like any other language. There seems to be no support for this either from MS or as an add-on.

The main motivation is to ease the development of dynamic methods, where we can actually see the stack, operations, memory etc in a proper debugger, right now developing dynamic methods is hit and miss, and very time consuming to debug (because the only assembler we can see in VS is native CPU !)

Also even if I debug C# code and select assembler in the source window I do NOT see IL assembler, only the jitted native assembler.

Is there any way to debug IL as IL, and see the stack etc etc?


Visual Studio doesn't draw properly.


When I load my Visual Studio (C++ 2010 Express and / or Visual Basic 2010 Express, it's even happened with Web Developer 2010 Express and C# 2010 Express), it never seems to work properly.

As I'm sure you know, at load a start page is meant to show with a list of previously opened projects and the latest news on the product, but for me its just a solid colour of purple from the background colour of the application. If I manage to load a project it does an initial refresh and seems fine, but when I scroll the code it doesn't refresh, the same can be said for when I goto edit the code.

I found that resizing the window and / or changing its maximized / minimized state generates a refresh and allows me to view changes, I've also found that restart my computer a few times or re-logging allows the VS collection to work fine. Interestingly it will work, but then if I close it for more than a few hours it stops, and vise-versa.

I've re-installed both C++ 2010 Express and Visual Basic 2010 Express at least twice, I also have the latest drivers and service packs.

Any help will be appreciated, I hate coding in Notepad++ and then debugging in VS.

ASP.NET 4 and Visual Studio 2010 Web Development Beta 2 Overview

Many exciting changes for ASP.NET are coming in the .NET Framework version 4. This document gives an overview of many of the new features that are included in the Beta 2 release of the .NET Framework 4 and of Visual Studio 2010.

Visual Studio 2010 Beta 2

This is a big deal. This isn't ".NET 3.6" - there are a lot of improvements of .NET 4, and it's not just "pile on a bunch of features so you get overwhelmed." I've been working with and talking to many of the teams involved and even though it's a cheesy thing to say, this is a really customer-focused release.

ASP 4 - Whirlwind Tour around .NET 4 (and Visual Studio 2010) Beta 1

There's a lot of stuff that's new and added in .NET 4, but not in that "overwhelming-I-need-to-relearn-everything" way. More in that, "oh, this is way easier/simpler now" way. Like, moving data around with ADO.NET DataServices is easy, binding with client templates is easy, there's F# if you need it, the "dynamic" keyword if you need it, Silverlight's already installed, oh, and the parallel stuff will freak you out, but in a good way.

Short Overview of SharePoint Features in Visual Studio 2010

As you probably know, Visual Studio 2010 was announced earlier this week and it contains a lot of cool features and project templates for SharePoint developers. Below is a short overview for some of the SharePoint development related features and project templates.

Visual Studio Add-In for Web Parts Generation

This article will introduce you to a new Visual Studio 2005/2008 add-in that can be used for Web Parts generation based on a prepared ASCX control/template. The add-in should allow Web Part developers to easily make Web Parts using the Visual Studio HTML designer. It should save you a lot of time and make Web Part development an enjoying experience even for beginners.

This article is written in the form of a step-by-step tutorial. It will give beginners a chance to successfully make, deploy, and try their first Web Parts, and will save some time for advanced users as you can always run into challenges when working with SharePoint.

Code spelling checker extension for visual studio 2010

Building a spelling checker for source code as an extension for visual studio 2010.

Download and Share Visual Studio Color Schemes

The good news is that Visual Studio allows you to completely customize the editor background and text colors to whatever you want - allowing you to tweak them to create the experience that is "just right" for your eyes and personality. You can then optionally export/import your color scheme preferences to an XML file via the Tools->Import and Export Settings menu command.

Visual Studio Shortcut Keys

The following tables describe the shortcut keys in the Microsoft Dynamics AX Debugger.

Visual Studio closes itself by opening aspx-Page designer after Windows Update


Hey Guys,

I've a problem with my Visual Studio.

On the 13th of August 2010 i installed a Windows update on my vista sp2 pc. For this date my Visual Studio 2008 sp 1 always has closed itself by opening an aspx-page in designer view. There is no error message just closing the window. I restored a backup of my windows from the time before updating it and it helped, i could open aspx pages in the design view till the update has been installed again automatically after rebooting the pc. I can't disable windows updates, cause it's my pc at work and safety is very important. I hope you could help me out of this disaster.



Visual Studio 2008 Memory problems


My memory in task manager reaches about 900,000K  and I don't know why it does this. Definately slows everything down, especially when I rebuild my tableAdapters, takes about 30 seconds sometimes to rebuild the project.

is it possible to convert whole visual studio 2008 web site project to visual studio 2010 web site p


is it possible to convert whole visual studio 2008 web site project to visual studio 2010 web site project


my current project references




i have a very annoying iis problem

iis server stops working until app pool is recycled


i am hoping that new visual studio (net framework 4.0) may solve this very annoying unsolveable problem


About Dynamic Data in Visual Studio 2010 / .NET 4



Does anybody here have any pointers to screencasts, demos, webcasts for the latest enhancements in Dynamic Data as listed in above link? I'm repeating them here for ready reference :


  • EnableDynamicData method which enables Dynamic Data features in existing ASP.NET applications and DataSource controls
  • A new QueryExtender control, contained in the sample projects to simplify common data filtering operations. It supports a rich ASP.NET declarative query syntax that makes it easy to do things like search data for text or have filters based on ranges
  • A new Dynamic Data filter model that enables the developers to apply templates to pages just like field templates (including user defined filters)
  • New field templates of Email, URL and Enum columns
  • Support for inheritance in Entity Framework and Linq to SQL
  • Support for many to many relationships in Entity Framework
  • New Entity Templates which allow fine control over how an object is displayed and edited
  • DynamicHyperLink control for building links to tables and actions
  • Declarative support for D
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend