All Questions
13 questions
1
vote
1
answer
555
views
Restoring Database SQL Server - data is null this method or property cannot be called on null values
I am trying to copy 2 databases from SQL Server 2012 to a new VM SQL Server 2017.
One of the databases was restored successfully but the other is giving me the below issues.
Databases both restored ...
1
vote
1
answer
63
views
ComboBox shows System.Data.DataRowView first
So in windowsform I have 2 ComboBoxes and one CheckedListBox for exercises. When you select your typefitness (calisthenics, weights, cardio, etc.) and your musclegroup (tricep, chest, back, forearms, ...
0
votes
1
answer
479
views
Seeding method is inserting additional Entities with NULL values
I am having this strange behavior all of a sudden (i have compared my files in version control (tfs) to be sure i did not change anything and i didn't found anything different).
I am seeding my ...
0
votes
1
answer
437
views
Should i set a column as NULL if there's records that will not use that specific column?
Does that make any difference?
Example:
I have a table with 5 columns, i use 3 columns for most things of my website, and 2 columns for the menu bar or anything else.
1
vote
1
answer
4k
views
Passing NULL values in a query string
I have a function called "InsertEmpolyee" that receives parameters to fill a query string. The thing is, I want to make some of these variables optional, in other words, I would like to be able to ...
1
vote
2
answers
180
views
Insert Null value into TSQL database
I am a little bit stucked even I have read qustions about null and databases. I am trying to figure out how can I send NULL to the database form C#. Method singature is
MyMethod(string category, int?...
0
votes
2
answers
2k
views
vb.net Date equivalent to String.Empty
In my program, I am writing a class to read values in one database table, and copy them into another.
When reading string fields, I have a function that is called which checks whether or not the ...
0
votes
2
answers
55
views
get value in variable from table
int value2;
using (SqlConnection dataConnection = new SqlConnection(@"Data Source=MANNAN-PC\SQLEXPRESS;Initial Catalog=WareHouse;Integrated Security=True;"))
using (SqlCommand dataCommand = new ...
1
vote
1
answer
1k
views
vb.net Error; The value for column 'Author' in table 'Books' is DBNull
This is a project I have done before but following the loss of source code I am rewriting this. But I am encountering an error that I have not come across before. (For info: The Column does have some ...
3
votes
4
answers
2k
views
How to assign a value to sqlparameter NULL values without checking for null or 0?
The following check is needed to check for null values. is there a way i can do it directly?
if(node.ID==0)
{
cmd.Parameters["@ID"].Value = DBNull.Value;
}
else
{
cmd.Parameters["@ID"]....
1
vote
2
answers
398
views
Nullable fails - dbnull to integer
In my class:
Namespace Chauffeurs
Public Class Algemeen
Property FirmaId As Integer?
Property Firma As String
Public Sub New()
End Sub
Public Sub ...
1
vote
2
answers
2k
views
Handling DBNull and null in ASP.NET
What is the best way of rewriting these (erroneous) lines?
bool? result = dr["result"] == DBNull.Value ? null : Convert.ToInt32(dr["result"]);
...and...
dr["result"] = result ?? DBNull.Value;
Both ...
5
votes
2
answers
2k
views
Automatically convert .Net null to DBNull.Value?
I've written a utility to handle adding values to data parameters for hand-rolling sql queries. Consumption looks like
utility.Add("SELECT * FROM MyTable WHERE MyColumn = {0}", myVariable, DBType....