<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
<channel>
  <title>Linux Format forums</title>
  <link>http://linuxformat.com/forums/index.php</link>
  <description>Help, discussion, magazine feedback and more</description>
  <language>english</language>
  <copyright>(c) Copyright Wed Jun 19, 2013 3:15 am by Linux Format forums</copyright>
  <managingEditor>webmaster@linuxformat.com</managingEditor>
  <webMaster>webmaster@linuxformat.com</webMaster>
  <pubDate>Wed Jun 19, 2013 3:15 am</pubDate>
  <lastBuildDate>Wed Jun 19, 2013 3:15 am</lastBuildDate>
  <docs>http://backend.userland.com/rss</docs>
  <generator>phpBB2 RSS Syndication Mod by Lucas</generator>
  <ttl>1</ttl>

  <image>
    <title>Linux Format forums</title>
    <url></url>
    <link>http://linuxformat.com/forums/</link>
    <description>Help, discussion, magazine feedback and more</description>
  </image>

                                      <item>
                                        <title>Re: Mono and sqlite (again)</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=13924#13924</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=148'&gt;tedius&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Mon Dec 12, 2005 1:05 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Nordle,&lt;br /&gt;
&lt;br /&gt;
Thanks for that, I do seem to have made a typo there (I have edited it to correct it now) &lt;img src=&quot;images/smiles/icon_smile.gif&quot; alt=&quot;Smile&quot; border=&quot;0&quot; /&gt;  The code wasn't I direct copy as I have cut some stuff out to make it smaller, though essentially it is the same.&lt;br /&gt;
&lt;br /&gt;
As for your comment &lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Quote:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;quote&quot;&gt;It says &quot;NOT NULL&quot;&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt; This is for the name and not that value which is what I'm trying to set to null.&lt;br /&gt;
&lt;br /&gt;
If people haven't guessed this is just a simple table that holds key:value pairs.  As it happened I would never insert NULL values into this table, but I have other larger ones where inserting NULL values makes more sense than inserting an empty string (my current work around)</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=13924#13924</comments>
                                        <author>tedius</author>
                                        <pubDate>Mon Dec 12, 2005 1:05 pm</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=13924#13924</guid>
                                      </item>
                                      <item>
                                        <title>RE: Mono and sqlite (again)</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=13897#13897</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=167'&gt;nordle&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sun Dec 11, 2005 2:41 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      I can't program, so sorry if I've missed the obvious, but the database design sais that it won't allow null values into name.  It sais &quot;NOT NULL&quot;.&lt;br /&gt;
&lt;br /&gt;
Also, your sql sais insert into _params, not insert into _internal.&lt;br /&gt;
&lt;br /&gt;
Im not sure i've understood / read that right though &lt;img src=&quot;images/smiles/icon_smile.gif&quot; alt=&quot;Smile&quot; border=&quot;0&quot; /&gt;</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=13897#13897</comments>
                                        <author>nordle</author>
                                        <pubDate>Sun Dec 11, 2005 2:41 pm</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=13897#13897</guid>
                                      </item>
                                      <item>
                                        <title>Mono and sqlite (again)</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=13734#13734</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=148'&gt;tedius&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Wed Dec 07, 2005 4:23 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      I'm having some more problems with mono and sqlite (version 3).&lt;br /&gt;
&lt;br /&gt;
This time it is that I have a method to insert some values into the data base, and I want to be able to insert NULL values.  But I can't find the way to do it.&lt;br /&gt;
&lt;br /&gt;
This is my insert method&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;public void Insert&amp;#40;string sName, object oVal&amp;#41;&lt;br /&gt;
&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; string sql = @&amp;quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; INSERT INTO _params&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; name,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; val&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#41; VALUES&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#58;name,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#58;val&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#41;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; SqliteCommand cmd = new SqliteCommand&amp;#40;sql, mConn&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; SqliteParameter param = new SqliteParameter&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; param.ParameterName = &amp;quot;&amp;#58;name&amp;quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; param.Value = sName;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; cmd.Parameters.Add&amp;#40;param&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; param = new SqliteParameter&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; param.ParameterName = &amp;quot;&amp;#58;val&amp;quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; param.Value = oVal;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; cmd.Parameters.Add&amp;#40;param&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; cmd.ExecuteNonQuery&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;#125;&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
The table was created with&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;CREATE TABLE _params&lt;br /&gt;
&amp;#40;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; name TEXT NOT NULL UNIQUE,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; val TEXT&lt;br /&gt;
&amp;#41;&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
When I run this code I get a NullRefrenceException, if I try and insert a null.  I have also tried to changing the line 'param.Value = oVal;' to&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;if &amp;#40;oVal == null&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; param.Value = &amp;quot;NULL&amp;quot;; // also tried &amp;quot;\0&amp;quot; and &amp;quot;&amp;quot;&lt;br /&gt;
else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; param.Value = oVal;&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
But the code either crashes or uses the value as a string and not a null value.&lt;br /&gt;
&lt;br /&gt;
Can anyone help me insert NULL values via the Parameter object.</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=13734#13734</comments>
                                        <author>tedius</author>
                                        <pubDate>Wed Dec 07, 2005 4:23 pm</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=13734#13734</guid>
                                      </item></channel></rss>