|
It must be something with your connection string. Try debugging on the cnn.open() line and take a look at what your connection string looks like though the quick watch. Make sure it's being set correctly.
|
|
|
|
|
Hi Kschuler,
connection string is perfectly fine, no problems. I have 2 that I can use, one for trusted and one for untrusted connections. Both fail.
Any other ideas?
|
|
|
|
|
Sometimes you can get a more detailed error message by putting a try catch block around the line of code that is in error...then put a breakpoint on a dummy line of code in the catch block so that you can quickwatch the exception object. Maybe that will give you more information to go on.
Sorry I can't be any more helpful.
|
|
|
|
|
Yeh, thanks for the help. Unfortunately Ive already done that.
Its baffling me. In two years of development in .Net, Ive never seen this error before.
|
|
|
|
|
|
Are you running this code from a trusted source? Running from a LAN server is NOT a trusted source, btw...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Yes,
I do believe that is the answer.
I cant confirm, but Im pretty sure the application was run from a server, not locally.
Many thanks Dave
|
|
|
|
|
In my ASP.NET.net site ,I sometimes(but not always) get this error :
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
I think its sql server error . Some one tell me how I can solve this problem.
I need urgent help .
|
|
|
|
|
Figure out what call is timing out, and work out if you can optimise what it is doing, so it does it faster. Or, increase the timeout if need be.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I encounter a problem regarding to the datagrid.
How can i get the value from the textbox (or other control) and bind to the datagrid?
Even it bind successfully, but the data display is in different row, how to make it in one row??
here is the code:
Dim a As String
a = txtSalesNo.Text.ToString
dgSales.DataSource = a
dgSales.DataBind()
Example, if the value is "ASD" from textbox,
the datagrid display 3 row in the same column.
How can i solve this problem?
Thanks for helps..
|
|
|
|
|
Databinding is for setting all the values. Setting a datasource as a textbox makes no sense, you want to set a value in one row/one column in that case. Is it ASP.NET or winforms ? If the latter, you can select a row from the Rows collection, and then select a column by name and set it's value.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
I'm using VB.NET 2005.
I've been playing around with a couple of macros lately and I've noticed that Debug.Print doesn't actually print anything to the Immediate Window. I've also tried Console.WriteLine but that doesn't work either. Neither one causes any errors, they just don't display anything. Is there any other way to get this functionality (At the moment I use a messagebox to show values at certain points but I figure there must be a better way).
Thanks very much,
dlarkin77
|
|
|
|
|
The output will show in the Output window, not the Immediate window. Have you launched a second Visual Studio instance to debug the code? IIRC, the instance of Visual Studio that your running in the code in cannot also debug it at the same time.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I have tried opening a second instance of VS. I double-click on the particular macro (in the Macro Explorer) in the first instance. Should I see the output in the second instance? At the moment I don't see any output. I've checked the immediate window and the output window in the second instance but there's nothing there.
Thanks,
dlarkin77
|
|
|
|
|
My data grid is showing some information from MYSQL using the ADODC.
How can i put this information from my DATA grid to EXCEL????
|
|
|
|
|
Hi
We are doing VB project, VB as frontend and mysql backend. How to write coding for mysql backup
thanks
KK
|
|
|
|
|
Hi,
I have a problem updating a spreadsheet. I can read the info into a datagridview, but cant get it to update... actually I am not to sure how to update the spreadsheet. Can someone maybe help me, or direct me to some site that can be helpful.
Code for select/read:
<br />
Public Shared Function OpenSpreadsheet(ByVal strPath As String) As DataTable<br />
<br />
'Create new dataset to hold information<br />
Dim tableStatement As New DataTable()<br />
Dim column(1) As DataColumn<br />
<br />
Try<br />
'Connectionstring to the xls spreasheet on local/network drive<br />
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _<br />
"Data Source=" & strPath & ";" & _<br />
"Extended Properties=""Excel 8.0;"""<br />
<br />
'strConn..open()<br />
<br />
Dim daTimesheet As New OleDbDataAdapter("SELECT * FROM [Sheet1$B8:F30]", strConn)<br />
daTimesheet.Fill(tableStatement)<br />
<br />
<br />
tableStatement.PrimaryKey = New DataColumn() {tableStatement.Columns("projectID")}<br />
<br />
Catch Ex As Exception<br />
MessageBox.Show("Cannot fill Datatable. OpenSpreadsheet(): " & Ex.Message)<br />
<br />
Finally<br />
tableStatement.Dispose()<br />
'strConn.close()<br />
<br />
<br />
End Try<br />
<br />
Return tableStatement<br />
<br />
End Function<br />
Code for update:
<br />
Public Shared Function UpdateSpreadsheet(ByVal strPath As String) As DataTable<br />
<br />
Dim tableStatement As DataTable = New DataTable<br />
<br />
'Connectionstring to the xls spreasheet on local/network drive<br />
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _<br />
"Data Source=" & strPath & ";" & _<br />
"Extended Properties=""Excel 8.0;"""<br />
<br />
Try<br />
<br />
Using connection As New OleDbConnection(strPath)<br />
<br />
Dim adapter As New OleDbDataAdapter()<br />
adapter.SelectCommand = New OleDbCommand("SELECT * FROM [Sheet1$B8:F30]", connection)<br />
adapter.UpdateCommand = New OleDbCommand("UPDATE [Sheet1$B8:F30] SET FirstName= ?, LastName = ?", connection)<br />
<br />
Dim builder As OleDbCommandBuilder = New OleDbCommandBuilder(adapter)<br />
<br />
connection.Open()<br />
<br />
adapter.Fill(tableStatement)<br />
<br />
tableStatement.PrimaryKey = New DataColumn() {tableStatement.Columns("projectID")}<br />
<br />
' Code to modify data in DataSet here <br />
<br />
adapter.Update(tableStatement)<br />
<br />
'Return 1<br />
Return tableStatement<br />
<br />
End Using<br />
<br />
Catch Ex As Exception<br />
MessageBox.Show("Cannot Update Datatable. UpdateSpreadsheet(): " & Ex.Message)<br />
'Dim strErrorUpdate As String = "Cannot Update Datatable. UpdateSpreadsheet(): " & Ex.Message<br />
<br />
'Return strErrorUpdate<br />
<br />
End Try<br />
<br />
End Function<br />
|
|
|
|
|
I am new to vb2005. I dun understand y do my DTPicker keep showing the calendar only. i have already set the formal to time but it only display the time but when i click the dropdown arrow it still show the caledar. Anyone knows how to change the calendar to time???
|
|
|
|
|
What do you expect it to show when dropped down?
|
|
|
|
|
I tot the DTPicker should show some default time for user to choose. i am confused as well? Cos i am doing the scheduler project require my user to choose the time for the shutdown to be perform. Wont the dropdown show some default selection which the user can select?
|
|
|
|
|
I'm calling a form with the show method, i would like to pass in a value from the calling form to the called form, to be used in form_load event.
How can I do this?
PJ
|
|
|
|
|
First you need to create the form before calling the Show() method.
Then you can pass the values either by creating parameters in the called form, or creating a function that receives parameter in the called form.
Another way is to create a new constructor of the form that accepts parameters.
"A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson
"Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin
Edbert
Sydney, Australia
|
|
|
|
|
Thanks for you help!
It's a bit wet here in Sydney
PJ
|
|
|
|
|
It's hailing in Hobart...
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
In the called form, you declaire a public shared variable like:
Public Shared myVar
In the calling form you will:
Dim mf as New CalledForm
mf.myVar = .....
mf.ShowDialog()
mf.Dispose()
Is this your need?
|
|
|
|