|
Hi,
I am trying to use the Fill() method of dataAdapter class to fill a dataset but Im getting a SqlException error when I run my code. The error says Invalid object name 'Testing'. My database name is Runner.mdf and Testing is a table in my database. Heres my code. Hope someone can help. Thanks
Dim ds As New DataSet
Dim cn As New SqlConnection()
Dim connString As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents\Runner.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
cn.ConnectionString = connString
cn.Open()
Dim da As New SqlDataAdapter("SELECT * FROM Testing", cn)
da.Fill(ds)
|
|
|
|
|
carrigart wrote: SELECT * FROM Testing
Is this query executing successfully in query browser?
|
|
|
|
|
How do you use the query browser. Is that the same as the object browser.
I'm not familiar with both of them anyway
|
|
|
|
|
Yeah I figured out how to use the query browser and my query is working fine. It returns the contents of my database. Still getting the same error, so frustrating.
|
|
|
|
|
and one more thing, the code executes fine when I comment out the line da.Fill(ds), So is there something wrong with my dataset.
|
|
|
|
|
Do you have the database (runner.mdf) included in your project? If you do, select it from the project explorer and from properties, check two things:
- path to the file
- is Copy to output directory true
If copy to output directory is true, you should attach the database from the projects debug/bin folder, since each time you start the project the db is copied to that folder. Also note that in this case, all modifications done by program are not reflected to the original database, which is included to the project.
|
|
|
|
|
Yes the database is included in my project. I have checked the properties and the 'Copy to output directory' is set to 'Copy Always'. I'm not sure that I get you. Is it that the Path to the file should be the file in the debug/bin folder. So would I have to change and connection string and setup a new data source. Bit confused sorry
|
|
|
|
|
carrigart wrote: would I have to change and connection string and setup a new data source
Yes, exactly, you should modify the connection string and attach the mdf from your projects debug/bin folder. You don't have to create a new datasource, just modify the connection string.
carrigart wrote: Bit confused sorry
Nothing to be sorry about
|
|
|
|
|
Fixed it . Only took me like a day . I changed the path off my connection string. Bit of a school boy error . Well its a lesson learnt anyway.
Thanks for your help
|
|
|
|
|
You're welcome
|
|
|
|
|
This may sound daft, but have you tried it by populating a command and then setting the dataadapter.selectcommand to the command?
|
|
|
|
|
Hey gang I got a web browser that I am creating for a group that I belong to. The question is I have everything set up they way it should look. The only thing missing is the ability to block pop ups when debug before I make it a finale cut for distribution. This is my first attempt I got some help form a friend form a different forum but he is stumped as well. I hope some one can point me in to the right direction.
|
|
|
|
|
Hi!
Are you using the .NET webbrowser control? I ask because the features it provides are quite limited so implementing a pop-up blocker from it would be next to impossible. You may want to look into CSEXWB It provides a far richer set of features than the standard control and, though it's written in C#, can easily be added to your VB project.
Hope This Helps!
MrWolfy
|
|
|
|
|
Yes it is in .Net I see your point is there a tool kit that I can download? And if so could you send me the link?
|
|
|
|
|
Hi!
Sorry for the late reply. There was a link to CSEXWB in my last post, and with web browser controls being insanely complicated under the hood (Loads of C++ and stuff) they are very difficult to manipulate from VB.
This is basically why CSEXWB was created, it exposes several underlying events, methods and properties that you could not normally access from VB.
Hope This Helps!
MrWolfy
|
|
|
|
|
I have a windows form which has several controls like buttons, listviews, labels and a textbox.
Is there any generic way to always keep focus on that textbox?
|
|
|
|
|
Wow - let's see. You have buttons and listviews, and you never want any of them to get the focus ? how would that work ?
I guess you could catch keypresses and always respond by focusing on the textbox.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
What my point is here. As soon as other control's work is done, then the textbox should be focus.
I dont want to put textbox1.focus in every control's lostfocus event. I hope you understand me.
Thanks!
|
|
|
|
|
xbiplav wrote: As soon as other control's work is done, then the textbox should be focus.
Then set is back to being focused. Control.Focus() method[^]
|
|
|
|
|
I WANT VB.NET CODE FOR MAKING PROJECT ......
MY PROJECT IS CONECTIVITY OF MOBILE AND COMPUTER TO SEND SMS AND MAKE CALL WITH USE OF COMPUTER.....
SO GIVE ME ADVICE ..... AND ALSO SEND CODE FOR THIS PROJECT.....
THANKYOU...
|
|
|
|
|
vish1433 wrote: I WANT VB.NET CODE FOR MAKING PROJECT
That would be your job to create the code.
vish1433 wrote: MY PROJECT IS CONECTIVITY OF MOBILE AND COMPUTER TO SEND SMS AND MAKE CALL WITH USE OF COMPUTER.....
So you have the requirements. Now break them to smaller pieces and then model your application and code it.
vish1433 wrote: SO GIVE ME ADVICE
Done that.
vish1433 wrote: AND ALSO SEND CODE FOR THIS PROJECT
Sorry, but it's not available on this site. Perhaps you should ask here: Rent-A-Coder[^]
|
|
|
|
|
|
How do I open the screen saver application using the Process control?
I just need to know the name of the file I need to execute it in the control so I can set the screensaver to 'None'.
Thnx in advance for any help on this.
rspercy
1 + 1 = 186,440....Depending on the species.
|
|
|
|
|
rspercy58 wrote: How do I open the screen saver application using the Process control?
I just need to know the name of the file I need to execute it in
Screensavers have the file-extension ".scr", you might want to search your computer for those. The default screensavers are in the Windows folder, but third-party screensavers usually end up in "Program Files".
You can start a screensaver by passing it's path & filename to the Start-method of the Process-class, like this;
Process.Start("C:\WINDOWS\system32\ssstars.scr")
This will not change the users' default screensaver to "None", it will only start the screensaver that you specified. If you want to build your own screensaver, then check out the sample that Microsoft[^] provided.
Hope this helps,
I are troll
|
|
|
|
|
After the treeview is filled is possible to:
count how may AG-xxxxx are in 8501-xxx, count how may items are in each AG-xxxxx, , count how may items are in each SETT. -xx, ....ecc
and store the result in a var
or
count during the treeview is filling and return the result in a var
in effect i want to count how many items are in each node with "+"...
this is my code to fiull treeview:
RSSQL2.MoveFirst
Do Until RSSQL2.EOF
sValue = Trim(RSSQL2.Fields("COD_AREA").value)
sKey = "K" & sValue
.Nodes.Add , , sKey, sValue & " - " & Trim(RSSQL2.Fields("DESCRIZIONE")), 1, 1
sValue = "AG. - " & Trim(RSSQL2.Fields("SPORT").value)
'sSQL = .Nodes.Count
.Nodes.Add sKey, tvwChild, "L" & sValue, sValue & " - " & Trim(RSSQL2.Fields("DESCRIZIONE2")), 1, 2
sKey = "L" & sValue
sValue = "SETT. - " & Trim(RSSQL2.Fields("PROVA3"))
SSQL = .Nodes.Count
.Nodes.Add sKey, tvwChild, "M" & sKey & sValue, sValue, 1, 2
sKey = "M" & sKey & sValue
sValue = "COPE - " & Trim(RSSQL2.Fields("PROVA1"))
.Nodes.Add sKey, tvwChild, "N" & sKey & sValue, sValue, 1, 2
'.Nodes.Item(sKey).EnsureVisible
RSSQL2.MoveNext
'sSQL = .Nodes.Count
Loop
|
|
|
|