&<undefined Value&>
Jul 20, 2005
Greetings,
I asked this question over on the ADO.NET newsgroup and couldn't scrape
up an answer. I realize that it is more of an ADO question than an SQL
Server question, but I'm hoping there might be an ADO programmer here
that can explain this to me.
I'm developing database applications using C# on VS.NET 2003 and SQL
Server Standard edition (SP3a).
I've run into a situation I'm trying to understand, to wit, if I submit
a query using SqlCommand.ExecuteScalar which returns no results, why is
the returned item a System.Object of <undefined value>?
(Actually, I think I know why -- ExecuteScalar returns a null reference
if there are no results.)
How do I do test for that condition?
I guess I can sort of see why they didn't want to throw an exception --
lot's of queries don't return any results, but on the other hand, I
can't figure out how to test for <undefined value>, either.
Any ideas?
-- Rick
View 2 Replies
Oct 12, 2004
When I submit data through my website one particular field which is drop down field and has 4 values (5, 10, Fee, other) saves as "undefined"
I get no errors through the web site.
Field is varchar
View 3 Replies
View Related
Apr 11, 2006
I have the following form
<head>
<title>Mapleside Farms</title>
<link rel="stylesheet" href="mapleside.css" type="text/css" />
</head>
<form name = "account" action="account.php" method = "post">
Enter information
<input type=text name="lastname">
<br>
<input type=text name="firstname">
<br>
<input type=text name="address">
<br>
<input type=text name="city">
<br>
<input type=text name="state">
<br>
<input type=text name="zipcode">
<br>
<input type=text name="email">
<br>
<input type=text name="username">
<br>
<input type=text name="password">
<br>
</form>
And the following php page
<?php
$Customer_Lname=$_POST['lastname'];
$Customer_Fname=$_POST['firstname'];
$Customer_address=$_POST['address'];
$Customer_city=$_POST['city'];
$Customer_state=$_POST['state'];
$Customer_zipcode=$_POST['zipcode'];
$Customer_email=$_POST['email'];
$Customer_username=$_POST['username'];
$Customer_password=$_POST['password'];
// open connection to database
$db = mysql_connect("localhost", "root", "");
if (!$db)
{
print "unable to connect!";
exit;
}
//select database to use
$db= mysql_select_db ("mapleside");
if (!$db)
{
print "could not select database";
exit;
}
// create SQL query string
$query = "INSERT INTO customer (Customer_Lname, Customer_Fname, Customer_address, Customer_city, Customer_state, Customer_zipcode, Customer_email, Customer_username, Customer_password) VALUES ($Customer_Lname, $Customer_Fname, $Customer_address, $Customer_city, $Customer_state, $Customer_zipcode, $Customer_email, $Customer_username , $Customer_password)";
$result = mysql_query($query);
mysql_query($query) or die
('Error, insert query failed');
echo('Data inserted successfully' );
//close connection
mysql_close();
?>
However, when I run my form and php pages, I get undefined variable errors. Can anyone lead me in the right direction????
View 2 Replies
View Related
Jul 24, 2007
Hi there, I am sorry to be abother but I was wondering if there was someone to tell me what I am doing wrong. Here is my statement. I am getting the following error.
Element SADDR1 is undefined in SESSION
SELECT [clv].[dbo].[UNIT].[HMY] ,[clv].[dbo].[UNITTYPE].[sdesc] ,[clv].[dbo].[UNIT].[SRENT]
,[clv].[dbo].[UNIT].[dtAvailable] , clv.dbo.property.saddr1, clv.dbo.unit.scode
FROM [clv].[dbo].[UNIT] inner join clv.dbo.PROPERTY on clv.dbo.property.hmy =
clv.dbo.unit.hproperty inner join clv.dbo.UNITTYPE on clv.dbo.UNITTYPE.hmy = clv.dbo.unit.hunittype
WHERE saddr1 = #session.saddr1# and ( hunittype='2' OR (hunittype='3') OR (hunittype='4')
OR (hunittype='5') OR (hunittype='6') OR (hunittype='7') OR (hunittype='8') OR
(hunittype='25') OR (hunittype='26') OR (hunittype='27') OR (hunittype='28') OR
(hunittype='29') OR (hunittype='30') OR (hunittype='31') OR (hunittype='32') OR
(hunittype='33') OR (hunittype='34') OR (hunittype='35') OR (hunittype='36') OR
(hunittype='37') OR (hunittype='39') OR (hunittype='41') OR (hunittype='42') OR
(hunittype='44') OR (hunittype='45') OR (hunittype='46') OR (hunittype='47') OR
(hunittype='48') OR (hunittype='49') OR (hunittype='50')
Thanks
View 2 Replies
View Related
Feb 19, 2008
Recently I migrated one dts package from sql server 2000 to sql server 2005. I chnaged the connection string as well. when i run it in BIDS, I don't get any error. But when I execute it in SSMS (under Integration service) I am getting one error. It is showing :-
Error : The task "Active X Scriopt Task undefined " cannot run in this edition of Integration services. It requires higher level edition.
Task Active X Script Task undefined failed.
What does it mean? How to solve it? I am using SQL server standard edision.
View 6 Replies
View Related
May 30, 2007
Hi,
I have a data flow task and trying to transform datas OLTP to STG db and i have lookup tables.
I do lookuping like this
first a lookup that lookup my table with connected input column parameter
second a derived column is connected to lookup's error output for when lookup can't find the value and this derived column returned "0" or "-1" this means that lookuped value can't find and insert this value to my table
third a union that union lookup and derived column
i want to ask this is there any different solution for doing this, because if i more than 5 or 6 lookup in my ssis package i add all of them derived columns and unions and when i change something i have to change or correct the unions step by step.
thanks
View 1 Replies
View Related
Feb 2, 2008
hello it seems lack of c# skills is getting the better of me here...iv been trying to get this to work for hours now without success. I have just started working in c# so i am a beginner :)
all i want to do it query the database, check to see if a title exists, if yes then populate textbox saying 'title in use' but if the title doesnt exists then continue executing rest of code to add the title.
You'll notice iv tried to use string variables and sqlDataAdapter but i cant get these to work either...please help
so far i have this that keeps giving me the error that my button click is undefined: protected void bookButton_Click(object sender, EventArgs e){
//string title;try{SqlConnection conn1 = new SqlConnection();
conn1.ConnectionString =
"Data Source=Gemma-PC\SQLEXPRESS;" +"Initial Catalog=SoSym;" +
"Integrated Security=SSPI;";SqlCommand findTitle = new SqlCommand("SELECT title FROM Publication WHERE title='" + titleTextBox.Text + "';", conn1);
conn1.Open();
findTitle.ExecuteNonQuery();
/*
DataSet myDataSetTitle = new DataSet("PublicationTitle");
myDataSetTitle.Clear();
myDataAdapterTitle.Fill(myDataSetTitle);//myDataSet contains results from above SELECT statement
title = myDataSetTitle.Tables[0].Rows[0]["title"].ToString();*/
}catch(Exception ex)
{TitleInvalidMessage.Text = "Title Not Accepted: This title is already in use by another publication" +ex.Message;
}
//title does not exist in table so continue and add to database
//rest of code here
View 5 Replies
View Related