VB / Sqlepress - Display A List Of Databases Contained In Sqlexpress In A Listview
Apr 12, 2010
I am trying to display a list of databases contained in sqlexpress, in a listview. my current code reads:
[Code]...
This will show up as column headers, but I can't get them to show in only one column so that I can have the user select the database that they would like to work with.
I'm trying to create a application that mimics windows explorer. I have a treeview and a listview. The problem I'm have is when I change from the initial "detail" view to "list" view the items in the list appear truncated. I have tried setting the column width property but it does nothing in "list" view.
I have a button that has the following code: Me.ListView_Documents.View = View.Details and Me.ListView_Documents.View = View.List
How can I display the full length of my items in a listview?
for example: If I have an item that had the following name: Actuator Review.doc in "detail" view the full name appears. but in "list" view the name appears as: Actuator Rev...
In my program, the user can select a icon for a shortcut generator. I googled "Extract icons from exe", and could only find nonworking answers to extract a single icon from an exe. I want a user to be able to select a program path and have a imagelistbox, flowlayoutpanel, or listview fill up with previews of all the icons. I want it to be similar to when you try to manual change a shortcut icon (you know that box with the exe path and the list of icons?). Is there any possible way to do this?
dim l as List(of MyClass) = new List(of MyClass) and I want to get the type of the objects contained in the list, how do I do that? The obvious answer, that doesn't seem to be possible from my actual implementation, would be to do something like this...
public function GetType(byval AList as IList(of GenericType)) as System.Type dim lResult as system.type = nothing if AList.Count > 0 then lResult = AList(0).GetType return lResult end function
But what if the list is empty and I still want to know the type it contains?
I have a question that I really hope someone can shed some light on for me, as this is driving me crazy trying to figure this out. Consider this code..
'declare and allocate Dim lstNumbers As New List(Of Integer) Dim nCount As Integer
am trying trying to write some code for a ComboBox that does the following:
1. Allow the user to enter text into the combo box to type entries contained in the list source.
2. Enable autocomplete to assist the user in selecting entries in the list source, both from dropped down state and non dropped down state.
3. Restrict the user from typing an entry that doesn't exist in the list source.
My requirements are:
1. The ComboBox must run some code after a selection has been made or the user has finished typing an entry (not after the focus has been moved to another control)
2. The code must only run once after the user has made a selection from the combobox or has finished typing an entry
The problem: To achieve the above functionality, I had to run code on numerous event's. Sureley there is a better way, here are the events and the reason for the code:
SelectedIndexChanged:This is the code that is run when the user makes a selection. No Mystery here
KeyDown:
Must Run If e.KeyCode = Keys.Return Then ComboBox1_SelectedIndexChanged(Nothing, Nothing) End If
I currently have an old database that has tables for requests and customers. This information is currently displayed in ASP.NET
What I was required to do, was to connect a new database for users into this system, while keeping the tables for the requests in the old database. Thus it is using 2 databases. I have set it up so, when a user creates a new request, in the request tables it saves it with his userID from the new database, but when the table is being displayed, it uses this new userID to find the user information from the old customers table. Thus I ended up with this:
Sub BindDataGrid() cmdoledb = New SqlCommand("SELECT r.customerid, r.RequestID, R.RequestDate, R.RequestDescription, a.AssignedTo, r.Urgency, r.ExCompletionDate from tbl_requests r, tbl_assignedto a where r.statusid = 1 and r.assignedtoid=
[Code]....
Currently it displays nothing, and gives out an error for myItem.Value = rdr.GetInt32(0) being a Null. I went through it step by step and it loads customerids normaly into the myItem.Value, but when they run out, it is supposed to exit, but keeps going, thus giving an error.
How do I display may sql databases in listbox without connection? Is it possible? Right now I have this:
Dim connString As String = "Data Source=.sqlExpress; Integrated Security=True;" Using sqlConn As New SqlConnection(connString) sqlConn.Open() Dim tblDatabases As DataTable = sqlConn.GetSchema("Databases") sqlConn.Close() For Each row As DataRow In tblDatabases.Rows ListBox1.Items.Add(row("database_name")) Next End Using
I am doing this because I wanted the user to create the connection for the main application to use. Right now, i have a combobox with items, MyServ/SQLexpress and ./SQLExpress. I have a textbox and a listbox where the user will choose from the items from the listbox which will then display in the textbox.... I dont like to explicitly put in my code this =.sqlExpress
In one of my button I have this code builder("Data Source") = Me.cboDataSource.Text.Trim builder("Integrated Security") = True builder("Initial Catalog") = Me.txtDBName.Text.Trim builder.ConnectTimeout = 30
I have a media browser program I am building. I am trying to use drag/drop so a user can drag media tracks from one listview to another listview and then use the second list view as a playlist in windows media player com object. Reading at MSDN I have found out that there is no built in support for item re-ordering with the listview control. I have listview1 working correctly but when I try to reorder items in listview2, the dragged item ends up at the end of the list. So basically I need to get the item insertion index corrected. I have tried more than 10 times to get this code right.
Here is my code which includes a form with two listview's.
Public Class Form1
Private Sub ListView_ItemDrag(ByVal sender As Object, ByVal e As _ System.Windows.Forms.ItemDragEventArgs) Handles ListView1.ItemDrag, _ ListView2.ItemDrag
I am unable to print the barcode value.where ever Ia m able to display the Little value.The main two functions are below.
vb.net Private Sub rfLoadtoList(ByVal iBarcode As String, ByVal iTitle As String, ByVal ImgIndex As Integer, ByVal bgColor As Color, ByVal frColor As Color, ByVal cFlag As Boolean) Dim Srnumber As Integer
i have to create a mortgage calculator (I know we have killed this mortgage calculator). Has to display an amortization table to display the list after doing the calculation. Here is the actual assignment:
Write the program in VB.Net (not Web based) and have it accept user input of the amount, term and interest rate. Display the mortgage payment amount. Then, list the loan balance and interest paid for each payment over the term of the loan. The list will be longer than the screen, so use loops to display a partial list, hesitate, and then display more of the list. Insert comments to document the program.
I have created 4 buttons. Calculate, Clear, List, and Exit. The buttons all work, but the list does not. Not sure what i am doing wrong.
I have added a list box and now i need help to display the data about my employees in the list box. How am i supposed to do that, do we have to put in codes or need to use that small arrow near the list box.
I'm so glad I found this forum. I have been trying for days to connect VB.NET Express to SQLExpress using a very simple, one-table database just for testing with no luck. Then I found this forum and the FAQ and used the template for binding a VB Form to SQL and with a few slight modifications and had success.
I'm connecting using the default instance of SQL (no user instance) and after substituting the the "user Id=" and "password=" section of the connection string with "Integrated Security=SSPI" I was finally able to get data returned from SQL server into VB in a Grid Control.
Now for my question. It's a general thing. Yes, I got that to work but in a complete database scenario, would the connection to the database be done in a Public Sub and left open throughout the duration of the GUI interface (passing in the user ID and password as needed) ..until the user logs off? In other words, the template example closes the connecttion immediately after retrieving the data from the database - and I realize this is an example of simply connecting. So, What is the usual scenario (in the real world for connecting and keeping that connection open for the duration of a user session. Where in the VB app should the connection string really be placed and the connection.(close) be placed?I'm not looking for an extremely detailed answer, just an "in general" scenario.I tend to dive in head first and so, I truly look for answers elsewhere before posting a question but haven't really found an answer to this exact question.
I have several programs I have written for my music studio/production company. Many dealing with inventory, customer DB etc. All of my programs are in VB6 and I have started to convert them all to VB.NET. I am getting proficient with VB.NET and connecting to DB using the very simple and generic connection strings, Example:
I have a listview control. it has an imagelist attached to it with two images in it. I have entered items into my listview, and they are using the first image in my imagelist.... GREAT! Now, there is a variable I have that will tell me which index in the listview is currently active, noting to do with what I select that could be at another index it's just what's being processed by the program at the time in some task.
Create a function that will change the images of all my listview items by looping through them. If the index variable is set to 2, I want the 3rd item in my list view set to use the 2nd image in my imagelist. The rest of the items in my listview need to be set to the first image in the imagelist.
I'm setting up a home database. I'm using sqlexpress. I want to use a vb.net programme to manage the database and currently added the database to my data sources. How would I create data for the tables? ( Tables are already set up )
I'm trying to export a table called material from a sqlexpress 2005 .mdf file called mydatabase to a csv file programatically in vb2008. i was looking at bcp and the shell command to call it, but simply can't get it to work - i'm calling it like so:
Shell("bcp mydatabase..material out 'c: est.txt' -c -T -S .SQLExpress")is there a way to do this without the shell? i would think it would be a little more professional looking for the app as a whole...
Visual Basic Project VB 2010 B2 does not allow you to select the SQL server without specifying a local file attachment while Visual Web Developer VWD 2010 B2 does give you the option to specify either.The Enviroment VB2010 B2, OS VISTA Business, SQL2008 Express SP1 with SQL Server Management Studio.
1) In order to access the SQL server enable the TCP/IP, NamedPipes and SQLbrowser on the SQL Server.
2) The VB Project requires "imports system.data.sqlclient"
3) Using SQL Server Management Studio or VBcode in the VB Project create a Server DataBase called "dbName"
4) Using SQL Server Management Studio or VBcode in the VB Project create a Server DataTables
5) The following code updates the SQL server DataBase name dbName from the projects DataSet.
Private Sub updateDBase(ByVal dbName As String, ByRef aDS As DataSet) 'CODE to access SQL database directly 'Before an Update sqlCommandBuilder creates
is there any way to attach a sql mdf by filename but actually make the database name something else?
the problem i'm having is that my connection string attaches the database just fine, but it gives the database a name of it's full path on the hard drive when i pull it up in SSMSE. ie. "c:program filesmy programmy database.mdf" is shown as the name when i do a sqlcmd and issue a select name from sys.databases
the snag is being hit due to the fact that i'm trying to do a "bcp in" and because a: there are spaces in the database name, and b: there's the .mdf extension also added to the database name that when i run my bcp in command it errors out, even if i use the -q option of bcp.
if i start SSMSE and right click the database and rename it, bcp works great - so my question is, how do i correctly format my connection string to attach to c:program filesmy programmy database.mdf, yet have it attach the database as "mydatabase" for use in bcp statements?
i've been to connectionstrings.com and they only cover the standard connection strings
in summary - i want to attach an mdf file programmatically and specify the name that ssmse see's it as....
I have created a windows exe project called MyCalculator,I have added setup deployment project.I have also added a class project and added a class called Sqlclass, code in this class is stated below
Public Class Sqlclass Public Sub New() Dim myProcess As New Process Dim SqlArguments As String
where to call the above class in deployment project so sql server installed automatically using the above parameter.check the above weather it is correct. After installation will the folder sqlexpress2005 remains?