Showing posts with label net. Show all posts
Showing posts with label net. Show all posts

Friday, March 30, 2012

Receiving system error when retrieving database record with null value

I have some VB.NET code to retrieve data from an SQL Server database and display it. The code is as follows:

-------------------------------

sw_calendar = calendarAdapter.GetEventByID(cid)

If sw_calendar.Rows.Count > 0Then

lblStartDateText.Text = sw_calendar(0).eventStartDate

lblEndDateText.Text = sw_calendar(0).eventEndDate

lblTitleText.Text = sw_calendar(0).title

lblLocationText.Text = sw_calendar(0).location

lblDescriptionText.Text = sw_calendar(0).description

Else

lblStartDateText.Text ="*** Not Found ***"

lblEndDateText.Text ="*** Not Found ***"

lblTitleText.Text ="*** Not Found ***"

lblLocationText.Text ="*** Not Found ***"

lblDescriptionText.Text ="*** Not Found ***"

EndIf

-------------------------------

If all of the fields in the database has values, everything works ok. However, if the title, location or description fields have a null value, I receive the following error message:

Unable to cast object of type 'System.DBNull' to type 'System.String'.

I've tried a bunch of different things such as:

Adding ".ToString" to the database field,Seeing if the value is null: If sw_calendar(0).description = system.DBnull.value...

...but either I get syntax errors in the code, or if the syntax is ok, I still get the above error message.

Can anyone help me with the code required to trap the nullwithin the code example I've provided? I'm sure there are other, and better, ways to code this, but for now I'd really like to get it working as is, and then optimize the code once the application is working (...can you tell I have a tight deadlineBig Smile)

Thanks,

Brad

Check forDBNullin VB.NET, with optional specification of type, so itconverts null to the appropriate value (e.g., "" for string, 0 fornumbers).

Good luck.

|||

Something like:

sw_calendar = calendarAdapter.GetEventByID(cid)If sw_calendar.Rows.Count > 0Then IF NOT IsDBNull(sw_calendar(0).eventStartDate)Then lblStartDateText.Text = sw_calendar(0).eventStartDate ELSEblStartDateText.Text ="*** Not Found ***" END IF IF NOT IsDBNull(sw_calendar(0).eventEndDate)Then lblEndDateText.Text = sw_calendar(0).eventEndDate ELSE lblEndDateText.Text ="*** Not Found ***" END IF IF NOT IsDBNull(sw_calendar(0).title) THEN lblTitleText.Text = sw_calendar(0).title ELSE lblTitleText.Text ="*** Not Found ***" END IF IF NOT IsDBNull(sw_calendar(0).location) THEN lblLocationText.Text = sw_calendar(0).location ELSE lblLocationText.Text ="*** Not Found ***" END IF IF NOT IsDBNull(sw_calendar(0).description) THEN lblDescriptionText.Text = sw_calendar(0).description ELSE lblDescriptionText.Text ="*** Not Found ***" END IFGood luck.
|||

Hi,

I tried addingIF NOT IsDBNull... but I still get the same error message. To make sure the problem is what I think it is, I changed the value of the description field in the database to a single space. After doing this, page renders fine. When I delete the space, the error returns. So, there is still a problem evaluating sw_calendar(0).location within the IsDBNull function.

Any ideas?

|||

I just tried:

If sw_calendar(0).description.Length >= 1Then

lblDescriptionText.Text = sw_calendar(0).description

Else

lblDescriptionText.Text =" "

EndIf

and itstill generates theUnable to cast object of type 'System.DBNull' to type 'System.String'. error message!

|||

The problem isnt with IsDbNull. The problem is with the strongly typed data row you are using. If you try to do IsDbNull(sw_calendar(0).description), sw_calendar tries to convert the description to a string and then pass that value to IsDBNull. However, sincesw_calendar(0).description is DBNull, it will always throw this error before DbNull ever gets it.

This, in my opinion, has crippled the Strongly Typed DataSets that are created with the TableAdapters.

The workaround is not to try to get the description withsw_calendar(0).description. Instead, usesw_calendar(0)("description"). Its not strongly typed, but at least it wont crash your app.

|||

One option would be to convert the values of NULLs to '' in case of strings and 0 or something similar in case of integers. You can achieve this in your query itself. There is a function call ISNULL in SQL. Basically you can use this function like ISNULL ( <column name> , '' ). This will replace the null values in the column to '' ( blank which is a legal string BLOCKED EXPRESSION. You can write select isnull ( description , '' ) as description. Then you are rest assured that the query itself will give you the valid string values instead of null and you having to bother to convert those nulls to blank string or something similar.

You can use this type of query when you are not sured about the values contained in the column, I mean in case the column may contain nulls also.

Hope this will help.

Receiving Error 26 when trying to connect to DB...Some Machines

Good Day,

We have a recently developed (and in testing) VB .Net application which attaches to a specific SQL2005 DB. The issue is that when installed (or run in DEBUG mode) on the developer box it successfully connects to the appropriate db locally and to the live server. When installed on a test box (several of them) we receive error - 26 Error locating Server/Instance Specified.

The SQL Server instance is set up for remote connections and works for other dbs.

All of the boxes are running XP Pro, with all SPs applied.

Any thoughts on what may be occuring would be greatly appreciated.

This might help:
"Connection error occurs when the Database Engine service account password expires

The

following error occurs when you connect to a report server, and the

service account password has expired for the SQL Server Database Engine

instance that hosts the report server database: "The report server

cannot open a connection to the report server database. A connection to

the database is required for all requests and processing.

(rsReportServerDatabaseUnavailable)."

The error message includes

these additional statements: "An error has occurred while establishing

a connection to the server. When connecting to SQL Server 2005, this

failure may be caused by the fact that under the default settings SQL

Server does not allow remote connections. (provider: SQL Server Network

Interfaces, error: 26 - Error Locating Server/Instance Specified)."

To resolve this error, reset the password. For more information, see Changing Passwords and User Accounts."

http://msdn2.microsoft.com/en-us/library/ms156468.aspx

Also check out this kb:
http://support.microsoft.com/kb/905618

Monday, March 26, 2012

Receipt with copies

I need some URGENT help!!! I developed a .Net Web App. I used the Crystal Report system included with VB .Net. to make a report that prints the clients receipt, but I need that same information to be repeated three times in the same page (original and 2 copies). The paper (8.5" x 11") is perforated in thirds. Ive tried to repeat the same info three times in the Crystal Reports document, without success... Ive tried subreports, etc... Any suggestions? Pleeeeeeeease help...
Thanks...Which database are you using?
You can have stored procedure having the query

Select query
Union All
Select query
Union All
Select query

and design the report using that stored procedure

Wednesday, March 7, 2012

really simple question

Hi Everyone,
I'd like to test developing in SQL on my peer network before installing
the application on my clients' servers. I am using VB.Net and MSDE as
my tools.
Question:
- Does MSDE have to be installed on each station in my peer-to-peer LAN?
or
Do I _only_ need to install it on the station with the actual database
files (mdf/ldf files)?
Thanks
Richard
hi Richard,
"Richard Fagen" <no_spam@.my_isp.com> ha scritto nel messaggio
news:%23G2LfjzEEHA.3784@.TK2MSFTNGP10.phx.gbl...
> Hi Everyone,
> I'd like to test developing in SQL on my peer network before installing
> the application on my clients' servers. I am using VB.Net and MSDE as
> my tools.
> Question:
> - Does MSDE have to be installed on each station in my peer-to-peer LAN?
> or
> Do I _only_ need to install it on the station with the actual database
> files (mdf/ldf files)?
>
as MSDE acts in a traditional client/server and multi-user situation, you
usually only have to install 1 instance of MSDE on the server that all
clients want to connect to.
if every pc on the lan hosts MSDE, than usually each of them will query the
local MSDE acting as a single user or desktop solution..
in the first scenario, only 1 MSDE server is available, every client will
connect to it and both queryes and results will be sent over the network..
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.6.0 - DbaMgr ver 0.52.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply

Really need to solve this SQL problem to finish this web site.

Hi,
i created a dataSet in an ASP.Net page which:
1. Loads all fields from each database record.
2. Creates a new field using 2 of the existing fields: FullName = FirstName
+ ' ' + LastName
3. Loads only the record which has the same FullName as the variable Name
passed in the URL to this page.
My SQL is this:
SELECT *, FirstName + ' ' + LastName as FullName
FROM people
WHERE FirstName + ' ' + LastName = ?
and:
<Parameter Name="@.FullName" Value='<%# IIf((Request.QueryString("Name") <>
Nothing), Request.QueryString("Name"), "") %>'
Type="WChar"/></Parameters></MM:DataSet>
Can you please tell me how to do this?
I know i allready asked this but until now i got no solution and i need to
solve this to finish this web site and deliver it.
I hope i was able to explain better my problem.
Thank You Very Much,
Miguel
Why are you putting the Request.Querystring in a pre-render block, should it
not be in regular code with the rest of it ? IE
Value = Request.QueryString("Name")
OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Miguel Dias Moura" <web001@.27NOSPAMlamps.com> wrote in message
news:%23UCksgXVEHA.2592@.TK2MSFTNGP09.phx.gbl...
> Hi,
> i created a dataSet in an ASP.Net page which:
> 1. Loads all fields from each database record.
> 2. Creates a new field using 2 of the existing fields: FullName =
FirstName
> + ' ' + LastName
> 3. Loads only the record which has the same FullName as the variable Name
> passed in the URL to this page.
> My SQL is this:
> SELECT *, FirstName + ' ' + LastName as FullName
> FROM people
> WHERE FirstName + ' ' + LastName = ?
> and:
> <Parameter Name="@.FullName" Value='<%# IIf((Request.QueryString("Name")
<>
> Nothing), Request.QueryString("Name"), "") %>'
> Type="WChar"/></Parameters></MM:DataSet>
> Can you please tell me how to do this?
> I know i allready asked this but until now i got no solution and i need to
> solve this to finish this web site and deliver it.
> I hope i was able to explain better my problem.
> Thank You Very Much,
> Miguel
>
>
|||Do you know the strange thing? I tested it and everything works fine...but
when i was testing in the Dreamweaver window where i place the SQL, i was
not getting any records...have no idea why is this...but well, at least it's
working.
Thanks for eveybody help and patiente...my code is working :-)
Thanks again for your time,
Miguel
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:OtAHCsXVEHA.3596@.tk2msftngp13.phx.gbl...
> Why are you putting the Request.Querystring in a pre-render block, should
it[vbcol=seagreen]
> not be in regular code with the rest of it ? IE
> Value = Request.QueryString("Name")
> --
> OHM ( Terry Burns )
> . . . One-Handed-Man . . .
>
> "Miguel Dias Moura" <web001@.27NOSPAMlamps.com> wrote in message
> news:%23UCksgXVEHA.2592@.TK2MSFTNGP09.phx.gbl...
> FirstName
Name[vbcol=seagreen]
IIf((Request.QueryString("Name")[vbcol=seagreen]
> <>
to
>

Really need to solve this SQL problem to finish this web site.

Hi,
i created a dataSet in an ASP.Net page which:
1. Loads all fields from each database record.
2. Creates a new field using 2 of the existing fields: FullName = FirstName
+ ' ' + LastName
3. Loads only the record which has the same FullName as the variable Name
passed in the URL to this page.
My SQL is this:
SELECT *, FirstName + ' ' + LastName as FullName
FROM people
WHERE FirstName + ' ' + LastName = ?
and:
<Parameter Name="@.FullName" Value='<%# IIf((Request.QueryString("Name") <>
Nothing), Request.QueryString("Name"), "") %>'
Type="WChar"/></Parameters></MM:DataSet>
Can you please tell me how to do this?
I know i allready asked this but until now i got no solution and i need to
solve this to finish this web site and deliver it.
I hope i was able to explain better my problem.
Thank You Very Much,
MiguelWhy are you putting the Request.Querystring in a pre-render block, should it
not be in regular code with the rest of it ? IE
Value = Request.QueryString("Name")
OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Miguel Dias Moura" <web001@.27NOSPAMlamps.com> wrote in message
news:%23UCksgXVEHA.2592@.TK2MSFTNGP09.phx.gbl...
> Hi,
> i created a dataSet in an ASP.Net page which:
> 1. Loads all fields from each database record.
> 2. Creates a new field using 2 of the existing fields: FullName =
FirstName
> + ' ' + LastName
> 3. Loads only the record which has the same FullName as the variable Name
> passed in the URL to this page.
> My SQL is this:
> SELECT *, FirstName + ' ' + LastName as FullName
> FROM people
> WHERE FirstName + ' ' + LastName = ?
> and:
> <Parameter Name="@.FullName" Value='<%# IIf((Request.QueryString("Name")
<>
> Nothing), Request.QueryString("Name"), "") %>'
> Type="WChar"/></Parameters></MM:DataSet>
> Can you please tell me how to do this?
> I know i allready asked this but until now i got no solution and i need to
> solve this to finish this web site and deliver it.
> I hope i was able to explain better my problem.
> Thank You Very Much,
> Miguel
>
>|||Do you know the strange thing? I tested it and everything works fine...but
when i was testing in the Dreamweaver window where i place the SQL, i was
not getting any records...have no idea why is this...but well, at least it's
working.
Thanks for eveybody help and patiente...my code is working :-)
Thanks again for your time,
Miguel
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:OtAHCsXVEHA.3596@.tk2msftngp13.phx.gbl...
> Why are you putting the Request.Querystring in a pre-render block, should
it
> not be in regular code with the rest of it ? IE
> Value = Request.QueryString("Name")
> --
> OHM ( Terry Burns )
> . . . One-Handed-Man . . .
>
> "Miguel Dias Moura" <web001@.27NOSPAMlamps.com> wrote in message
> news:%23UCksgXVEHA.2592@.TK2MSFTNGP09.phx.gbl...
> FirstName
Name[vbcol=seagreen]
IIf((Request.QueryString("Name")[vbcol=seagreen]
> <>
to[vbcol=seagreen]
>

Really need to solve this SQL problem to finish this web site.

Hi,
i created a dataSet in an ASP.Net page which:
1. Loads all fields from each database record.
2. Creates a new field using 2 of the existing fields: FullName = FirstName
+ ' ' + LastName
3. Loads only the record which has the same FullName as the variable Name
passed in the URL to this page.
My SQL is this:
SELECT *, FirstName + ' ' + LastName as FullName
FROM people
WHERE FirstName + ' ' + LastName = ?
and:
<Parameter Name="@.FullName" Value='<%# IIf((Request.QueryString("Name") <>
Nothing), Request.QueryString("Name"), "") %>'
Type="WChar"/></Parameters></MM:DataSet>
Can you please tell me how to do this?
I know i allready asked this but until now i got no solution and i need to
solve this to finish this web site and deliver it.
I hope i was able to explain better my problem.
Thank You Very Much,
MiguelWhy are you putting the Request.Querystring in a pre-render block, should it
not be in regular code with the rest of it ? IE
Value = Request.QueryString("Name")
--
OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Miguel Dias Moura" <web001@.27NOSPAMlamps.com> wrote in message
news:%23UCksgXVEHA.2592@.TK2MSFTNGP09.phx.gbl...
> Hi,
> i created a dataSet in an ASP.Net page which:
> 1. Loads all fields from each database record.
> 2. Creates a new field using 2 of the existing fields: FullName =FirstName
> + ' ' + LastName
> 3. Loads only the record which has the same FullName as the variable Name
> passed in the URL to this page.
> My SQL is this:
> SELECT *, FirstName + ' ' + LastName as FullName
> FROM people
> WHERE FirstName + ' ' + LastName = ?
> and:
> <Parameter Name="@.FullName" Value='<%# IIf((Request.QueryString("Name")
<>
> Nothing), Request.QueryString("Name"), "") %>'
> Type="WChar"/></Parameters></MM:DataSet>
> Can you please tell me how to do this?
> I know i allready asked this but until now i got no solution and i need to
> solve this to finish this web site and deliver it.
> I hope i was able to explain better my problem.
> Thank You Very Much,
> Miguel
>
>|||Do you know the strange thing? I tested it and everything works fine...but
when i was testing in the Dreamweaver window where i place the SQL, i was
not getting any records...have no idea why is this...but well, at least it's
working.
Thanks for eveybody help and patiente...my code is working :-)
Thanks again for your time,
Miguel
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:OtAHCsXVEHA.3596@.tk2msftngp13.phx.gbl...
> Why are you putting the Request.Querystring in a pre-render block, should
it
> not be in regular code with the rest of it ? IE
> Value = Request.QueryString("Name")
> --
> OHM ( Terry Burns )
> . . . One-Handed-Man . . .
>
> "Miguel Dias Moura" <web001@.27NOSPAMlamps.com> wrote in message
> news:%23UCksgXVEHA.2592@.TK2MSFTNGP09.phx.gbl...
> > Hi,
> >
> > i created a dataSet in an ASP.Net page which:
> >
> > 1. Loads all fields from each database record.
> > 2. Creates a new field using 2 of the existing fields: FullName => FirstName
> > + ' ' + LastName
> > 3. Loads only the record which has the same FullName as the variable
Name
> > passed in the URL to this page.
> >
> > My SQL is this:
> >
> > SELECT *, FirstName + ' ' + LastName as FullName
> > FROM people
> > WHERE FirstName + ' ' + LastName = ?
> >
> > and:
> >
> > <Parameter Name="@.FullName" Value='<%#
IIf((Request.QueryString("Name")
> <>
> > Nothing), Request.QueryString("Name"), "") %>'
> > Type="WChar"/></Parameters></MM:DataSet>
> >
> > Can you please tell me how to do this?
> > I know i allready asked this but until now i got no solution and i need
to
> > solve this to finish this web site and deliver it.
> >
> > I hope i was able to explain better my problem.
> >
> > Thank You Very Much,
> > Miguel
> >
> >
> >
>

Really need some suggestion on SQLCacheDependency.

I have some problem with ASP.NET cache, I found other people has similar problem, but I didn't find real solution.

The one bother me most is the SQLCacheDependency doesn't work stable. I insert object in cache and has SQLCacheDependency linked. After a period of time, it stopped working. That means the the object is still in cache, but change on db side doesn't remove the cache entry. I am not sure if it is ASP side or SQL side, I feel it is ASP side.

I am using 2.0 + SQL 2005.

Once the db command notification stop working, you have to restart IIS or clear all items in cache since you don't kno which one is changed.

Any suggestion?

Noone help? no MVP in this forum? or I should post this on .NET 2.0 forum?

Does the problem exist? or it is not a problem, just my code? in either case, I think I need some confirmation.

I have been used the cache for almost one year, I still have the same issue today. Will someone from SQL team or ASP.NET team see this post?

|||This is pretty late but have you solved your problem yet? Did you find a solution?|||

No, I can not find a way to test what is wrong, it never works consistent for me. Now I can not rely on notification from db. Every time when I change my record, I have to tell my web server to clear the relative cached items.

|||Post some code where you are inserting the item in the Cache.

Thanks,|||

string cacheKey = LinkSites.GetMappedKey(virtualPath, fileid.ToString()); // this will return a key from virtualPath
if (!String.IsNullOrEmpty(cacheKey)) frd = (FileRecordData)HttpContext.Current.Cache[cacheKey];
if (frd == null)
{
int siteid = 0;
SqlCacheDependency scd = null;
lock (_connection)
{
try
{
SqlCommand sqlcmd = new SqlCommand("select ownerid,id,uniqueid,parentid,category,name,content,dated=isnull(updated,created),created,updated,isdirectory from dbo.link_sourcestore whereid=@.id", Connection);
sqlcmd.CommandType = CommandType.Text;
SqlParameter sqlparam;
sqlparam = sqlcmd.Parameters.Add("@.id", SqlDbType.Int);
sqlparam.Value = fileid;

scd = new SqlCacheDependency(sqlcmd);
using (SqlDataReader reader = sqlcmd.ExecuteReader())
{
if (!reader.HasRows) return null;
reader.Read();
siteid = LinkRoutine.Convert(reader["ownerid"], 0);
frd = GetRecordData(reader);
}
}
catch (Exception e)
{
ErrorHandler.Report("GetCachedFileRecord 2 [" + realVirtualPath + "," + virtualPath + "]", e);
return null;
}
}

if (scd != null)

{
frd.CacheKey = cacheKey;
frd.CacheDependency = scd;
HttpRuntime.Cache.Insert(cacheKey, frd, scd, Cache.NoAbsoluteExpiration, new TimeSpan(24, 0, 0), CacheItemPriority.NotRemovable, new CacheItemRemovedCallback(LinkCacheHandler.RemovedCallback));
}
}

It just read the record and add into cache, when cache item removed, call the static method RemovedCallback in LinkCacheHandler, LinkCacheHandler is posted below. After I restart IIS, it will work for a while, 5, 10 or more minutes, but after a while, even I set breakpoint in RemovedCallback, I don't get anything when I change the record. (when I call my clear cache method, which will remove all records from cache, it runs to the breakpoint. So the callback is fine)

public class LinkCacheHandler
{
public static void RemovedCallback(string k, object v, CacheItemRemovedReason r)
{
if (!k.Contains("system/cache.ascx"))
{
LinkSites._cacheLog += "RemovedCallback[" + DateTime.Now.ToString() + "]<br/> " + k + ((v is FileRecordData)?(" : " + ((FileRecordData)v).CacheKey) : "") + " " + r.ToString() + "\n<br/>";
LinkSites.NotifyCacheObject(k);
}
}
}

|||There are various conditions on which it wont work. Like I think you need to use the full names in your SQL SELECT queries like dbo.Categories instead of Categories. Also you cannot use the aggregate functions like SUM, COUNT and things like that. Make sure your queries are free from all those. You can check book online to find more restrictions.

I also see that you are using HttpRuntime.Cache.Insert. Try using HttpContext.Current.Cache.Insert instead.

Hope it helps!|||

Well, you can tell from my code I pasted I didn't break any of the rules. And the situation is not it never works, it just doesn't work stable.

I read an article talks about HttpRuntime.Cache and HttpContext.Current.Cache, they don't have difference, except the HttpRuntime.Cache is a little efficient.

There are many articles about how to use cache, but they are the same, just list out some general commands. I guess what I find out is how to trace the cause of the problem when the cache stop working. You know there are several steps to push the change from db to web server. So far, I havn't found any article goes deep on that.

|||

Quick note: I believe HttpContext.Current.Cache implicitly calls HttpRuntime.Cache so they're functionally identical.

Beyond that, the one thing I can mention that I discovered at first is that a callback isn't called every time the database changes, it's called every time the cache is invalidated. This obviously means that if you haven't repopulated the cache, you won't hit your breakpoint when you change your data.

This makes perfect sense: the callback is for cache item invalidation and there's no item to invalidate if the cache isn't repopulated. Nevertheless it caught me off-guard when I started working with the SqlCacheDependency (though I don't know why it should have).

I don't know if you are having a similar brain fart, but otherwise I can also suggest you might try checking out the SQL Server MSDN forums here:http://forums.microsoft.com/MSDN/default.aspx?ForumGroupID=19&SiteID=1.

I've had some pretty good luck getting questions answered there.

|||

Hmm, it doesn't look like it can happen in my code. Everytime cache item dependency changes, the cache item will be removed from cache, and it will call the callback. And when I use a object, I always try to get it from cache. If it is not in cache, I will read it and insert it in cache before use it.

When it stopped working, I found the items were still in cache, but it doesn't be removed when data changed.

|||

Well, what I mentioned is more about operator-error/misperception than faulty code, but if the item is still in the cache, you're right: you're not experiencing the problem. I know it sounds silly, but I spent about 15 minutes wondering why my callback function wasn't getting hit when data changed, and it was simply because the data was already invalidated/ not in cache.Stick out tongue

What you say makes me a little nervous, however, since I'm using the SqlCacheDependency in a similar way. If you nail down the problem please post back here and let us know what was up so we know how to avoid potential stability issues!

|||

I hope I can, I havn't solved the problem for a year. Since I started to use the beta last year.

Another thing may not may relate to this, you can see I set my cache to NoAbsoluteExpiration and expire date is 24 hours. But if no activities on the site, all cached items will be cleared after 20-30 minutes. I had set the applicaiton pool to make sure it doesn't recycle worker porcess. This happens on both my dev and live servers.

|||

There is a know issue with .Net 2.0 and SQLCacheDependency that causes the caching to stop working after 5 minutes. Here is the link to the hot fix.

http://support.microsoft.com/kb/913364/EN-US/

Tyler

Monday, February 20, 2012

Real time "live" data on a windows application .NET 2.0

I want to build a windows application in Visual Studio 2005 that grabs some data from a SQL DB and displays it in a gridview. That is easy and I already have it done, but I also want to know how to show this data in real-time. For example: right now we have a application that pulls some login information for all the users and displays their phone extension, their name, and their status. They can change their status by clicking on some radios below the datagrid and on change it updates the data and then posts back. However, I dont know how the guy who did it made it so that these local changes are automatically shown on everyone elses computers around the office. In other words, they are shown the live data as it changes, without having to refresh it or anything. How would I go about doing this or does anyone have any places/resources that could help me accomplish this task. Thanks.

Oh and the guy who wrote this is no longer working here and he deleted the source code so i cant look at it.

Here's the answer I got from one of our Dev:

there are two methods, a push method or a pull method: you could use something like NotificationServices (I haven't used this. There's some data on it athttp://msdn2.microsoft.com/en-us/library/ms170722(en-US,SQL.90).aspx) to tell you that the data has changed, or you could poll at intervals (or during lulls in processing time) for changes in data.

Either way you go, you're going to face problems of collisions if the users can change the same data. What would you do if you're in the middle of editing a row, and another user deletes it, and you poll for data?

Hope that helps,

Lan

|||

thanks for the reply. the application is designed to only allow the user to change their own data, therefore there will be no way that any user can be changing the same data. I will take a look at that article.

Ready Tool for SQL Ce Compact Edition

We have a plan to use Microsoft SQL Server 2005 Compact Edition RC1 as a backend. Our Front-end is VS .NET (VB.NET).

We want to know how to edit the Compact Edition database (.SDF). Is there any editor is available right now in the market? or microsoft provided any editor for this.

OR Can i use microsoft 2005 sql server standard edition for this.

Thanks

You can find two desktop editors in my company's website. The first is based on .NET 1.1 and is now showing its age. If you want to take a look at the second, please be advised that although it has much more features, it is still a draft (but works). Comments and suggestions are welcome.|||You can edit the .sdf right in vs2005 or SQL 2005 Management|||

I use SQL Server 2005 Management Studio to edit it.

But be weary, the functionality is very limited. For example, you can't add foreign key constraints, or editing an existing table, in many cases, requires you to rebuild the table... but there isn't a feature to export your table to a script.

I would highly suggest scripting the table instead of using the GUI.

|||

Hi,

After a great struggle we have comeup with our own tool designed for managing the SQL compact edition database.

Here the url http://www.satwhiz.com/datapump/info.html . You can download the beta tool.

Please post your comments to gopalan@.sofist.com

Thanks

Gops

Sofist India