|
Well, actually it is true that I'm working for dissabled people at the moment, and your thoughts and escepticism, even though they are reasonable, they show the kind of person you are.
I'm not rambling angry, this is your own understanding of my lines. For you it looks like I'm trying to make you responsible of my problems, that only shows again the kind of person you are. I was just trying to encourage you.
I don't think it is necessary to mention dissabled people to get some help on the Internet, fortunately, there are a million people clicking around that will help without any use of guiltyness.
Yeah, you pissed me off, do you know why?
Because you came here making serious acusations without even knowing a single thing about me.
If you have a solution or an answer, you can just drop it and keep your sick thoughts for yourself and your toilet time, you don't need to prove how smart you are and neither need to make me read those awful lines just to give me this tip. I know what is Internet, thank you for the advice.
Thank you too for your link, even though it is not only a question of changing registry, but more extense.
But you are right, I did not explain myself pretty well and I was in the wrong forum too.
I wont come back, so keep your energy and don't answer me back.
|
|
|
|
|
When I ran the debugger I get an error that says that it can't find this column in the database. I know the column exists.
Does anyone know why?
Dim dcDay As New DataColumn("Day of Week", GetType(String), "lpDataSet.tbl_teach_sched.ts_dayColumn")
modified on Wednesday, February 20, 2008 12:57 PM
|
|
|
|
|
It can't find the column because the expression you supplied isn't valid. You shouldn't be specifying DataSet names and tables in it. All it needs is column names or some expression that assumes the correct table.
|
|
|
|
|
I did not have option strict on and when I ran the debugger I got an error message that said conversion from DBNull to Date is invalid. I checked my database and I do not have any NULL's in the database at all.
Why am I getting this error?
Then I turned option strict on and I get errors that say implicit conversion from type object to either date, Integer or string are not valid.
Dim dr As DataRow<br />
Dim intDay As Integer<br />
Dim intDays As Integer<br />
Dim intStudID As Integer<br />
Dim intLessID As Integer<br />
Dim startTime As DateTime<br />
Dim endTime As DateTime<br />
Dim lessTime As DateTime<br />
Dim foundRows() As Data.DataRow
Here is the code that is underlined with option strict on.
intDay = dr("ts_day")<br />
startTime = dr("ts_from")<br />
endTime = dr("ts_to")<br />
intStudID = foundRows(0)("stud_id")<br />
intLessID = foundRows(0)("less_id")<br />
lessTime = foundRows(0)("less_time")<br />
intDays = foundRows(0)("less_day") - 1<br />
' This is at the end of the loop to increment the start time<br />
startTime += startTime.Add(timeInterval)
To use option strict on how should I do this? The dataRows hold information from the database.
|
|
|
|
|
You're getting the errors because you're not explicitly converting the values returned by the DataReader to the appropriate types. You're still relying on implicit conversions. All of your "dr(something) expressions return an Object, not an Interger or String or DateTime. You have to explicitly convert those Objects to the appropriate types:
intDay = Convert.ToInt32(dr("ts_day"))
|
|
|
|
|
When I declare startTime I declare it as a DateTime. Also timeInterval is declared as a timespan. Why does this give me an error that it can't convert from date to string?
startTime += startTime.Add(timeInterval)
|
|
|
|
|
Don't know. There isn't enough information to tell. Possibly, your datetime is stored in the database as a string??
|
|
|
|
|
I created a UDT named time from dateTime. The database stores both the time and the date 1/1/1900. Then with the following code I convert it to dateTime because the info is in a dataRow. Does this help?
startTime = Convert.ToDateTime(dr("ts_from"))
|
|
|
|
|
AAGTHosting wrote: The database stores both the time and the date 1/1/1900. Then with the following code I convert it to dateTime because the info is in a dataRow. Does this help?
None of this makes any sense, so no.
You created your own datatype, inheriting from DateTime?? May I ask why and what the implementation looks like?
|
|
|
|
|
The code is equivalent to:
startTime = startTime + startTime.Add(timeInterval)
As you see, you are trying to add two DateTime values. There is no operator overload for the addition operator that does that, so the compiler tries to convert the values to types that can be added. The only conversion that gives data types that can be added, is converting them to String s. Therefore the compiler assumes that you are trying to do this:
startTime = startTime.ToString() + startTime.Add(timeInterval).ToString()
However, as you are using Option Strict On , implicit conversions from DateTime to String is not allowed.
The statement is illogical. Is it not this that you are trying to do really?
startTime = startTime.Add(timeInterval)
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Good evening All
I have found a new job and they want me to Stop vb.net and move to C#. well i have done C++ and Java in my Academic days and never used it again, and now that Pain world comes in again. i have never used C# , in VB.net we drop controls to the forms and start code behind the Control using different Events, in C++ its a Pain to Create a Form in old Java JDK 1.2 its realy a pain to design a Form, because you had to align the Controls in the pane. So what i want to know is that , If C# is a .NET language, do you still Drop a Control and Code its Event ? or its still a Pain of Creating UI ? and a lot or Arrays declaration, Threads ?, Cant i design my logics in vb.net and Allow a C# developer to Access those Logics ? cant we be on the same team but using different languages? is vb.net going to Die? What is it, that is in C# that we cannot do in vb.net? Cant vb.net do handle security ? are they not .NET languages ? on the Same PlatForm? is there a realy a need to move from vb.net to C#?
Thanks
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
|
|
|
|
|
Writing forms etc, in VB.net or C# is more or less the same. The syntax in C# pushes you to write slightly neater code, to my mind, but essentially there is no difference.
|
|
|
|
|
The reason to move is simply that you cannot write an application in mixed languages. So, you have to conform to your team. The differences are mostly just syntax, everything else works the same. I don't use VB.NET ( I hate it ), but I answer questions here all the time, because my knowledge of C# translates easily to vB. I just hate the syntax.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Vuyiswa wrote: I have found a new job and they want me to Stop vb.net and move to C#.
Good for you.
Vuyiswa wrote: If C# is a .NET language, do you still Drop a Control and Code its Event ?
Yes, you actually use the same designer as with VB.NET. It's just the language in the code file that differs.
Vuyiswa wrote: Cant i design my logics in vb.net and Allow a C# developer to Access those Logics ?
If you work in separate projects, it would be possible to use different languages, but I wouldn't recommend it. I don't think that your boss wants code in different languages, code maintenence is hard enough as it is.
Vuyiswa wrote: is vb.net going to Die?
Sadly, no.
Vuyiswa wrote: What is it, that is in C# that we cannot do in vb.net?
Actually very little, as they use the same framework.
Don't fear the C#. It's actually a quite nice language. If in the end you find that you still like VB.NET better, you will have gained a better understanding of the framework and programming in general, so you will have become a better VB.NET programmer also.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thanks guys for Advice
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
|
|
|
|
|
I'm looking at someone else's code and noticed that they have placed a Dim statement inside a loop. What is the impact of doing such a thing ?
I'm used to declaring all of my variables at the top of a function/procedure and not anywhere else in the code. (Just my preference - Old school)
Here is a snipet of code:
For i as Integer = 0 to ref.Length - 1
DIM STAT AS INTEGER
< ... lines of code removed..>
STAT = Cint(ObjProperty("STATUSIND","FORMULA",ref(i)))
<... lines of code removed ...>
next
Thanks,
david
|
|
|
|
|
There is no performance hit. It's actually faster than if you put "STAT = 0" in the same spot and put the Dim outside the loop.
|
|
|
|
|
I am more concerned that by having a "Dim" statement inside a loop that it would cause some excessing memory usage or potentially a memory leak. Initially, I wasn't concerned about performance. Thank you for your quick response.
|
|
|
|
|
Dave Kreskowiak wrote: It's actually faster than if you put "STAT = 0" in the same spot and put the Dim outside the loop.
You are comparing code that is not equivalent. The variable is initalised to zero only once, regardless of where in the code it's declared. Where the Dim statement is placed only affects the scope of the variable, the generated code is exactly the same regardless if the variable is declared inside or outside the loop.
Example:
Dim s As String = String.Empty
For i As Integer = 1 To 5
Dim x As Integer
If i = 3 Then x = 1
Console.WriteLine("{0}: {1}", i, x)
Next
The output:
1: 0
2: 0
3: 1
4: 1
5: 1
As you see, the variable x is initialised to zero eventhough it's not assigned any value until the third iteration in the loop. Once it's assigned a new value, it retains the value for the remaining iterations, demonstrating that the variable is never re-initialised.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Crap. The effects of getting 4 hours of sleep a night for the last 2 months...
|
|
|
|
|
Hi Friends..
I need to bind the dataset return value to excel.The thing is ..if i bind to a datagrid and then if i import to excel it works..But what i need is to bind the dataset directly to excel without the intervention of datagrid..Someone help in this regard as early as possible.
Thanks In Advance..
Balaguru
|
|
|
|
|
You can't bind an Excel worksheet directly to a DataTable in .NET. Excel doesn't know anything about .NET classes so can't directly interface with them. You'd have to build the worksheet cell-by-cell from the DataTable. You can checkout this[^] and this[^] for examples.
|
|
|
|
|
Hi all,
How can use the IN Operator with Parameters. Any Example will be helpfull
Thanks
Dana
|
|
|
|
|
Hello Dana,
The values that do not fit into a neat range, we use the IN operator. An example would be:
Select * from Customers
Where CustID IN (1, 3, 5);
The above query will give us rows for CustID 1, 3 and 5 from the Customer's table.
Regards,
Dave
Dave Traister
Software Engineer
ComponentOne LLC
www.ComponentOne.com
|
|
|
|
|
Thanks for the post Dave Traister,
How can I implement this using Sqlcomamnd.Parameters object
Regards,
Dana
|
|
|
|