Showing posts with label null. Show all posts
Showing posts with label null. Show all posts

Tuesday, March 27, 2012

Enumerate ODBC System records

By calling CDatabase::OpenEx(NULL, CDatabase::forceODBCDialog)
you get the ODBC DSN Control panel selection screen thingy to choose from.
That screen has File, System and perhaps more tabs on them
I want to not go through that selection window, instead only enumerate the
System DSNs in my own app.
I know this info is stored in the windows registry, but I'm looking to do
this using the right way: documented API's.
Any idea ?
LisaTake a look at the SQLDataSources API. This will allow you to enumerate the
DSNs.
HTH
--
============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@.m_ with @. to reply.
"Lisa Pearlson" <no@.spam.plz> wrote in message
news:OjuNz$02DHA.1760@.TK2MSFTNGP10.phx.gbl...
quote:

> By calling CDatabase::OpenEx(NULL, CDatabase::forceODBCDialog)
> you get the ODBC DSN Control panel selection screen thingy to choose from.
> That screen has File, System and perhaps more tabs on them
> I want to not go through that selection window, instead only enumerate the
> System DSNs in my own app.
> I know this info is stored in the windows registry, but I'm looking to do
> this using the right way: documented API's.
> Any idea ?
> Lisa
>

Wednesday, February 15, 2012

Entering null into blank fields in the database

How can I enter NULL manually in one of the rows in Sql Server database. Those rows does not contain any data.
you can use DbNull.Value. If its a datetime datatype you need to use SqlDateTime.Null and import Sqltypes namespace.
|||well the problem is bit different. I have 4 rows with 4 fields each. Like Name, Age, Address, Phone number.
Now Name, Age , Address is filled with some data. But I forgot to adddata for the phone and now its just blank. How can I make this nullinstead of blank.

|||UPDATE
<table>
SET
[phone]= NULL
WHERe
[phone] = ' '

Entering Empty Node Using An Updategram

Hi there,
I was wondering if anyone has found how to add an empty (not NULL) node
to an update. I found if you create a node you can get it to enter an
empty space by setting the default value to ('') on the database so
that when you query the data you have an empty node returned. The
problem I'm having is when I want to "blank" a node so I have something
like:
<before>
<node>Some text</node>
</before>
<after>
<node/>
</after>
which will result in a NULL value. Is there something I can put in the
after node that will result in it producing the same as ('') or
something to that effect?
Thanks,
GaryGary,
I'm assuming you are using the XML datatype and want to perform this DML via
the .modify() method.
In that case, you can use the replace value of DML statement. The new value
you want is "empty" or (). Here is an example:
declare @.x xml
set @.x = '<foo>bar</foo>'
set @.x.modify('replace value of /foo[1]/text()[1] with ()')
select @.x
You will most likely need to modify this DML if you are using a typed xml
column.
Regards,
Galex Yen
"Gary" wrote:

> Hi there,
> I was wondering if anyone has found how to add an empty (not NULL) node
> to an update. I found if you create a node you can get it to enter an
> empty space by setting the default value to ('') on the database so
> that when you query the data you have an empty node returned. The
> problem I'm having is when I want to "blank" a node so I have something
> like:
> <before>
> <node>Some text</node>
> </before>
> <after>
> <node/>
> </after>
> which will result in a NULL value. Is there something I can put in the
> after node that will result in it producing the same as ('') or
> something to that effect?
> Thanks,
> Gary
>|||you need to use xsi:nil. Here is the documentation and an example:
http://msdn2.microsoft.com/en-us/library/ms171764.aspx
<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql"
xmlns:updg="urn:schemas-microsoft-com:xml-updategram"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<updg:sync mapping-schema='StudentSchema.xml'>
<updg:before/>
<updg:after>
<Student SID="S00004" lname="Elmaci" minitial="" years="2">
<fname xsi:nil="true">
</fname>
</Student>
</updg:after>
</updg:sync>
</ROOT>
"Gary" wrote:

> Hi there,
> I was wondering if anyone has found how to add an empty (not NULL) node
> to an update. I found if you create a node you can get it to enter an
> empty space by setting the default value to ('') on the database so
> that when you query the data you have an empty node returned. The
> problem I'm having is when I want to "blank" a node so I have something
> like:
> <before>
> <node>Some text</node>
> </before>
> <after>
> <node/>
> </after>
> which will result in a NULL value. Is there something I can put in the
> after node that will result in it producing the same as ('') or
> something to that effect?
> Thanks,
> Gary
>

Entering Empty Node Using An Updategram

Hi there,
I was wondering if anyone has found how to add an empty (not NULL) node
to an update. I found if you create a node you can get it to enter an
empty space by setting the default value to ('') on the database so
that when you query the data you have an empty node returned. The
problem I'm having is when I want to "blank" a node so I have something
like:
<before>
<node>Some text</node>
</before>
<after>
<node/>
</after>
which will result in a NULL value. Is there something I can put in the
after node that will result in it producing the same as ('') or
something to that effect?
Thanks,
Gary
Gary,
I'm assuming you are using the XML datatype and want to perform this DML via
the .modify() method.
In that case, you can use the replace value of DML statement. The new value
you want is "empty" or (). Here is an example:
declare @.x xml
set @.x = '<foo>bar</foo>'
set @.x.modify('replace value of /foo[1]/text()[1] with ()')
select @.x
You will most likely need to modify this DML if you are using a typed xml
column.
Regards,
Galex Yen
"Gary" wrote:

> Hi there,
> I was wondering if anyone has found how to add an empty (not NULL) node
> to an update. I found if you create a node you can get it to enter an
> empty space by setting the default value to ('') on the database so
> that when you query the data you have an empty node returned. The
> problem I'm having is when I want to "blank" a node so I have something
> like:
> <before>
> <node>Some text</node>
> </before>
> <after>
> <node/>
> </after>
> which will result in a NULL value. Is there something I can put in the
> after node that will result in it producing the same as ('') or
> something to that effect?
> Thanks,
> Gary
>
|||you need to use xsi:nil. Here is the documentation and an example:
http://msdn2.microsoft.com/en-us/library/ms171764.aspx
<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql"
xmlns:updg="urn:schemas-microsoft-com:xml-updategram"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<updg:sync mapping-schema='StudentSchema.xml'>
<updg:before/>
<updg:after>
<Student SID="S00004" lname="Elmaci" minitial="" years="2">
<fname xsi:nil="true">
</fname>
</Student>
</updg:after>
</updg:sync>
</ROOT>
"Gary" wrote:

> Hi there,
> I was wondering if anyone has found how to add an empty (not NULL) node
> to an update. I found if you create a node you can get it to enter an
> empty space by setting the default value to ('') on the database so
> that when you query the data you have an empty node returned. The
> problem I'm having is when I want to "blank" a node so I have something
> like:
> <before>
> <node>Some text</node>
> </before>
> <after>
> <node/>
> </after>
> which will result in a NULL value. Is there something I can put in the
> after node that will result in it producing the same as ('') or
> something to that effect?
> Thanks,
> Gary
>