|
Oh, you were answering, not asking. The code you posted is still messy, even if SqlDateTime.Null works.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
in DB completiondate allows null
but it still gives same error
with regards
rahul
|
|
|
|
|
How do you know it allows null ? In any case, your error is not that null is not allowed, but that the date object is broken. I think you need to make your code typesafe, walk through with the debugger and see what date is passed in. You also need to fix your code where it is prone to breaking.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
This is messy. What if the text entered cannot be converted ? This code is fragile and not production quality, on many levels.
I need to see the code that throws that error, in order to comment on it.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
DateTime? StatusDate,CompletionDate;
if (txtStatusDate.Text != "")
{
StatusDate = obj.ConvertStringToDate(txtStatusDate.Text);
}
else
{
StatusDate = null;
}
i am get error in below code
public Boolean InsertTask(string oprtype, object StatusDate)
{
Database db = DatabaseFactory.CreateDatabase();
string sqlcommand = "DailyReport";
DbCommand dbcommand = db.GetStoredProcCommand(sqlcommand);
db.AddInParameter(dbcommand, "@oprtype", System.Data.DbType.String, oprtype);
if (StatusDate != null)
{
db.AddInParameter(dbcommand, "@StatusDate", System.Data.DbType.DateTime, StatusDate);
}
else
{
db.AddInParameter(dbcommand, "@StatusDate", System.Data.DbType.DateTime, DBNull.Value);
}
db.ExecuteNonQuery(dbcommand);
return true;
}
with regards
rahul
|
|
|
|
|
rahul.gharat wrote: object StatusDate)
Why are you still passing this as an object ? In any case, if this is passing DBNull.Value, and the procedure fails, then your database doesn't support null. That's really about it. Have you tried running the proc directly against the database ? What does the proc look like ?
I can't help but feel that if you made this code typesafe, it might well work. You're not passing a datetime, you're passing an INullable<DateTime> and I can't help but wonder if that makes a difference, when all you tell the compiler is that it's an object.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
good morning every one,
i generated a website application using asp.net with c#.net.i want to deploy that website but i donot know how to deploy the website,plz tell me how to deploy the website by a step by step procedure.
thanks in advance.
|
|
|
|
|
Copy the files onto the server. Make sure the server has ASP.NET installed. Point IIS to your site.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Just 2 day back there was a same Question on CP.
Check [^]
You can find step by step description over there.
-------------
This is one of the common question that i have faced in this forum. So I have planned for write a step by step guide to deploy the sites. Hope I will upload it in CP as early as possible
|
|
|
|
|
Step1:Make sure that the IIS is Installed,
Step2: Make sure that the Correct .NET Framework for your Application is Installed
Step 3: Create an Virtual Directory
Step 4: Copy your Files in the Vurtual Directory
And thats it
Simple ne
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
And you repeated the advice already given because.,..... ? These repeat answers flood the forums, an easy question sometimes gets 8 answers, all of them the same.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Sorry about that
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
chaeck the links
[^]"> [^]">
Cheers!!
Brij
|
|
|
|
|
Hi, How can I create a move next command in web development???
Dim DS As New DataSet
TextBox1.Text = DS.Tables(0).Rows(DS.Tables(0).Rows.Count() + 1).Item("ITEM_NAME")
This code that I've used just give a move last command and i can't figure out how to the move next so that I can look for the items in my data base one-by-one.
can you give me some solution?
Thanks a lot in advance.
|
|
|
|
|
do you want to show the ITEM_NAME one by one in textbox?
Cheers!!
Brij
|
|
|
|
|
yes, that's what I'm trying to do. But the code that I've used only showed me the last item in my query.
|
|
|
|
|
You can do onething
Start from 0,increment it and save it in viewstate then next commond take the value from viewstate and show it again same way increment and save it viewstate .Do the same till last element.And show the value like below
TextBox1.Text = DS.Tables(0).Rows(int.Parse(viewstate["counter"])).Item("ITEM_NAME")
Cheers!!
Brij
|
|
|
|
|
Brij wrote: TextBox1.Text = DS.Tables(0).Rows(int.Parse(viewstate["counter"])).Item("ITEM_NAME")
I've tried your code but there are some errors. The "int" can't be loaded and there's a identifier need in the ["counter"] part.
|
|
|
|
|
Keep a Global Variable
and increment it's value when u click on MoveNext
Global Variable intGlobalCount
TextBox1.Text = DS.Tables(0).Rows(intGlobalCount ).Item("ITEM_NAME")
|
|
|
|
|
how can i declare this Global Variable?
|
|
|
|
|
Global variables are ALWAYS a sign of bad design and bad programming. In any case, where would he keep it so that it maintains it's state between postbacks ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
yes your right. I've tried to make a variable to act like a counter but ever time the page will postback, the value of the counter will return to its original value.
|
|
|
|
|
Well, the basic issues you have are:
1 - you are requesting the last row ( actually one past ), so that's what you see
2 - as it's a website, if you want the user to click next, and then see a new record, what you're doing is very wasteful. Why not just request the row you want to see ?
3 - the best place for you to store an index of the current record, is the URL. The second best, is viewstate. A static variable is an idiotic idea, it will break your site as soon as you have two users.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
yeah. but actually I'm just trying to get the logic of how to check the item one-by-one. Because I'm trying to make a loop statement that will check for the item one-by-one and arrange it in a hierarchy arrangement in my repeater. But if you could give some other alternative and easiest way to do this, that will be a huge help.
|
|
|
|
|
The whole point of a repeater is that you define a single template, then bind to a data source, and it takes care of that. If your data is heirarchical, then you need to nest repeaters and create a data source that presents the data in a logical way. However, this question is pretty much totally unrelated to what you asked inthe first instance.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|