|
Yeah... That's what I think at first...
I'm using SQL both, SQL and Windows Authentication, and.... nope....
¿Any other ideas? ¿Do you think is something related to Interop?
|
|
|
|
|
I am kind of running out of ideas. So the cast error has gone away? What is the exact error coming from SQL? I am still thinking that the start up or the form load event isn't working as expected.
Ben
|
|
|
|
|
I'm still having the cast exceptions, so I've stop using the convertion from String to Boolean, so that is not a problem (for now....)
The exact SQL exception is:
... "an error has ocurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections"... (I'm using SQL Server 2000)
And I'm sure the start up method is working fine....
I'm already out of ideas...
|
|
|
|
|
That is really weird. The only time I have gotten that error is when the sql server was actually down. I guess the only other thing I can think of, which I think you already checked is what the connection string it right before you open the connection in the vb.net app.
Ben
|
|
|
|
|
I checked the connection string again.
I'm using a configuration file to load some connection options, and it appears that when is executed from VBA the options "loaded" are blank....
I don't know why, but at least i know what the problem is.
THANKS A MILLION BEN!!!!!!!!!!!!!!!!!!!!!!
-- modified at 18:13 Wednesday 21st February, 2007
|
|
|
|
|
Basically i have a listbox and need to take each item (string) out of that listbox to populate textboxes, so the first listbox item goes into the first textbox, second to second etc...
Here is the code that i have for this that works.
For i As Int16 = 0 To lstListbox.Items.Count - 1<br />
Select Case i<br />
Case 0 : txt1.Text = lstListbox.Items(i).ToString<br />
Case 1 : txt2.Text = lstListbox.Items(i).ToString<br />
Case 2 : txt3.Text = lstListbox.Items(i).ToString<br />
Case 3 : txt4.Text = lstListbox.Items(i).ToString<br />
Case 4 : txt5.Text = lstListbox.Items(i).ToString<br />
Case 5 : txt6.Text = lstListbox.Items(i).ToString<br />
End Select<br />
Next<br />
My question is, how do i randomly do this, instead of having the first item go to the first textbox etc, so perhaps having the first item going to the txt5 or txt3 for example and so on.
Help or guidance would be brilliant, thanks!
|
|
|
|
|
You'll need to add each textbox to a list and then randomly select which one you want. Once you pick the textbox you set the text and remove it from the list so it's not chosen again. This should work for you.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'This list will contain our textboxes
Dim itemList As New List(Of TextBox)
'Add each textbox to the list
itemList.AddRange(New TextBox() { _
txt1, _
txt2, _
txt3, _
txt4, _
txt5, _
txt6})
Dim rnd As New Random 'Random number generator
For i As Int16 = 0 To lstListbox.Items.Count - 1
'Pick a random textbox
Dim index As Integer = rnd.Next(0, itemList.Count)
itemList(index).Text = lstListbox.Items(i).ToString
'Remove the textbox so we can't pick it again
itemList.RemoveAt(index)
Next
End Sub
You can write a small routine that dynamically adds each textbox to the list instead of hardcoding them in there, but if you know you'll just want to popullate these 6 you don't have to go to the trouble.
|
|
|
|
|
Brilliant, it works a charm!
Thanks a million TwoFaced!
|
|
|
|
|
where i create internet dialup connection programatically
|
|
|
|
|
i want to create a log file in the dtabase project to ensure the security
|
|
|
|
|
cicandre wrote: i want to create a log file in the dtabase project to ensure the security
Good for you. Did you just want to tell us this? Or, do you have a specific question?
|
|
|
|
|
Is it possible to write a VB program to shutdown your PC or a PC on the network. I use XP and .net 2003.
Any ideas?
|
|
|
|
|
|
I use a desktop icon that could easily be used as "process.start(shutdown.exe -s -t 00)"
Shutdown: %windir%\System32\shutdown.exe -s -t 00
Restart: %windir%\System32\shutdown.exe -r -t 00
Logoff: %windir%\System32\shutdown.exe -l -t 00
Hope this helps!
|
|
|
|
|
In vb.net when i bring a date and time over from the database it sets it up in the datagrid as 30/12/1899 it is meant to be a time but when i click on the datagrid it puts the time into the text box but i need the time to be showing in the datagrid for some reason it is showing a date. any solutions.
|
|
|
|
|
You are pulling it as a time and just binding it to the datagrid with no formatting? The datagrid should just show what you give it unless you have setup a format.
Cleako
|
|
|
|
|
just have time in database 19:30 and then pullit to datagrid but it shows a date in datagrid 30/12/1899 and then when i select a row from the datagrid to populate the text boxes it pulls the time i am a little confused but have not set any format for it.
|
|
|
|
|
I m working on a module where I fetch the table information from database, and display it in Datagrid.I am able to view all the records.
Actual procedure is :
User selects from the list of tables in the database, then select the operation to perform(Ex add, update,del,view) then that table information is displayed accordingly in the datagrid. At runtime the recordsource for the datagrid changes to the name of the table selected from the list.
Now when I do update to a table with non-numeric information i get the following error.
[Oracle][ODBC][Ora]ORA-01461: can bind a LONG value only for insert into a LONG Column.
This error I searched on Internet, it says to check for any data conversion that is done in the coding. But I have only fetched the data in Adodc & updated there itself.
Can any one help me to solve this problem.
Upma
-- modified at 5:45 Wednesday 21st February, 2007
|
|
|
|
|
Hi Upma,
The conversion in your case is implicit.
Upma wrote: Now when I do update to a table with non-numeric information i get the following error.
You are trying to convert a long to a string. You should probably set the column in the table to long.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
dataadapter update method problem
sanjiv raj rao kusuma
|
|
|
|
|
sanjiv raj wrote: dataadapter update method problem
Care to give us more details about your "dataadapter update method problem"? It is very difficult to help with so little information. It is like phoning a mechanic and saying "car driving problem"
|
|
|
|
|
i cannot add reference file "csMusicMedia.dll" into my VB.NET application as a library file.
the error says,
"this is not a valid assembly or COM component. only assemblies with extension 'dll' and 'COM' components can be referenced. please make sure that the file is accessible, and that it is a valid assembly or COM component."
but the .dll file i using ia a valid library file.
|
|
|
|
|
siva503 wrote: but the .dll file i using ia a valid library file.
"library"? C and C++ produce libraries. .NET languages produce assemblies. You cannot add a library file to a .NET application unless you use DllImport.
|
|
|
|
|
does anyone knows on how to disable local area connection progmatically?
|
|
|
|
|
Hi All,
I need to add a help file within my system (i.e: steps to use the system), I have searched in all items imbedded within VS 2005 but I did not file item like help file. Is there any body who may help ???
Kind Regards
OBarahmeh
Palestinian Central Bureau of Statistics (PCBS)
Ramallah-Palestinian Territory
|
|
|
|