DataGridView/SQL Express - Updating Record Using Seperate Form
Dec 7, 2006
Hi,
I am currently using VC++/Cli 2005. In a project, I'm using a DataGridView control to show records from a SQL Express 2005 table. Instead of updating a specific item directly within DataGridView control, I would like to open a new form and allow user to update selected record/item within that form. The reason to update this way is conditionned by the fact that I have 3 levels of detail as following:
Level 0 Level 1 Level 2
1:N 1:N
Furniture --> Component --> Component
You all understand that update form of Level1 will/must include, as Level0 do, another DataGridView control to display/detail all related items issued from next level. This explains why I can't allow user to update Level 1 directly from DataGridView control.
I've searched in MSDN and even bought a few books on subject but unfortunately I found nothing on how to do it this way. All articles on DataGridView control were only showing how to update record directly from control.
My approach, I think, would be to transmit to my level1 updating form, as a single parameter, the selected DataRow object (or a brand new one if currently adding) issued from DataGridView and let user update it's content. When User finally leaves level0 update form, then I presume that DataGridView corresponding table would be automatically updated according to DataGridView's content.
What would be the proper way to do it? I would certainly appreciate to hear you view on this.
Also, what can I do if I want to refresh DataGridView's content when coming back from update form. Is it done automatically? I would certainly be sure that it reflects the reality, not only when I update it myself but also especially when other users could concurrently update same records?
Hey all, Here is what I would like to do.. if any can give some advice or direction with this i would appreciate it.
We have a "master database" (MS SQL) at our main office. Then a smaller office with only a dial-up connection. Can I have my db application write all the data input to a local DB. Then write something to connect with the master DB, through a Terminal server, etc., and update it with the data from the other smaller db?
Im having some issues understanding how to manipulate the data that is in my DataGridView
The View is created by calling a stored procedure from VB code and works on two tables:
people pswds
The columns required from Table people are (personid, userid and sort).
The columns required from Table pswds are (comment and activeuser).
Table people is parent table while pswds is the child table.
The Relationship works between both tables using primary keys from both tables: which is called personid in both.
The link below shows the Relationship Diagram for the Two tables:
http://cale.csd.anglia.ac.uk/~csd03ib/images/RelationTables.bmp The code for the Stored procedure can be found at the following Link:
http://cale.csd.anglia.ac.uk/~csd03ib/images/StoredProcedure.bmp Now the DataGridView returned by the Stored procedure produces the following output found at this link:
http://cale.csd.anglia.ac.uk/~csd03ib/images/DataGridView.bmp Of course there are many more results returned for this DataGridView but i have only shown a few of them. What i really need to know is: Can this view be made to be editable? I need to be able to update the both the Active user Check box and the Comment Columns from this view I hope someone can help Thx Flakky
We're running a Sage CRM install with a SQL Server 2000 database at the back end. We're using the Sage web services API for updating data and a JDBC connection to retrieve data as it's so much quicker.
If I retrieve a record using the JDBC connection and then try and update the same record through the web services, the query times out as if the record is locked for updates. Has anyone experienced anything similar or know what I'm doing wrong? If I just use DriverManager.getConnection() to establish the connection instead of the datasource, and then continue with the same code I don't get these record locking problems. Please find more details below.
Thanks, Sarah
The JDBC provider for the datasource is a WebSphere embedded ConnectJDBC for SQL Server DataSource, using an implementation type of 'connection pool datasource'. We are using a container managed J2C authentication alias for logging on.
This is running on a Websphere Application Server v6.1.
i wanted to ask how to insert values from a single web form into two sql tables, i have been looking and the visual web developer i use doesnt seam to allow me to even atempt it i've tried selecting all the values from two different tables and then adding those two tables to an insert function but it doesnt work likewise the update functioni have values in a table currently a reference number and i want to use this reference number to update the address values in this table so update this field.table1 and thisfield.table2 when ref number = @ refnumber the reference number is present in both tables and is linked PK to FK <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:Back End DataConnectionString %>" SelectCommand="SELECT StartDetails.StartDetailsID, StartDetails.ContractIDNo, StartDetails.ContractName, StartDetails.NINO, StartDetails.AnticipatedStartDate, StartDetails.StartDateTime, StartDetails.StartDateLetterSent, StartDetails.StartDate, StartDetails.AnticipatedEndDate, StartDetails.ActualEndDate, StartDetails.ReasonForLeaving, StartDetails.Provider, StartDetails.AdviserReferrer, StartDetails.ProvisionCat, StartDetails.Provision, ClientDetails.NINO AS Expr1, ClientDetails.CentreNo, ClientDetails.FirstName, ClientDetails.SecondName, ClientDetails.AddressLine1, ClientDetails.AddressLine2, ClientDetails.PostCode, ClientDetails.ContactTelephoneNumber, ClientDetails.MobileNo, ClientDetails.Email, ClientDetails.DateOfBirth, ClientDetails.Gender, ClientDetails.PWD, ClientDetails.Ethnicity, ClientDetails.ClientGroup, ClientDetails.RepeatStartDate, ClientDetails.CaseworkerName, ClientDetails.ClientStatus, ClientDetails.PlacementDates, ClientDetails.JobsearchDay, ClientDetails.AchievedILP, ClientDetails.JobDate, ClientDetails.JobDate2, ClientDetails.JobDate3, ClientDetails.EligibleForRolledUpWeeks, ClientDetails.NoOfWeeksClaimed, ClientDetails.MarketingWhere, ClientDetails.Notes, ClientDetails.JobCentre, ClientDetails.JobCentreRep FROM StartDetails INNER JOIN ClientDetails ON StartDetails.NINO = ClientDetails.NINO WHERE (StartDetails.StartDetailsID = @StartDetailsID) AND (StartDetails.NINO = @NINO)" InsertCommand="INSERT INTO [StartDetails] ([NINO], [StartDate], [AnticipatedEndDate]) VALUES (@NINO, @StartDate, @AnticipatedEndDate)"
I am getting an error message when trying to up to update a database from a form. It appears a simple looking error but I can't seem to see what the problem is Any ideas would be appreciated
This is the error message Line 1: Incorrect syntax near '('. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near '('.
Source Error:
Line 95: sqlConnection.Open Line 96: Try Line 97: rowsAffected = sqlCommand.ExecuteNonQuery Line 98: Finally Line 99: sqlConnection.Close
How to I make it so that a Authenticated User to a website can append a record to a SQL table. I have watched the video on the asp.net website about using database on a web, it shows how to allow a user to change a record in a database, but nothing I have seen so far shows how they can append a record.
What I am trying to do: I am building a website for a ATV club using Visual Studio 2005 and c#. I am setting up users or members on the site (club members will have a user account, while all others will be un-authenticated users. I am setting up a classifieds area where members can post items for sale, items they are looking for, etc.
I am planning to use roles to allow authenticated users access to a webpage located in a restricted directory. There I want to place a XHTML page which would allow the users to post their classified ads for free. I will have another page that will allow everyone to view the ads not just club members. I want to make this as easy to maintain as possible. I don’t plan on having all the postings come through me to be placed on the web, I want it all automated.
Hello I got a sql server express that i am trying to connect form win or web forms(2.0) €“ express as well.
My problem: Can not connect to the server in any way! Even the designer cont find any sql server on my machine; for example "the data source configuration manager" (gui) in enyn way its can not find the sql server express (2005)
So my question is: if all what i used is the express version - is it possible to connect and use the sql.s express form the vs. express
System.Data.SqlClient.SqlException was unhandled Class=16 ErrorCode=-2146232060 LineNumber=65536 Message="Directory lookup for the file "C:Documents and Settingszimmerman_eMy DocumentsVisual Studio 2005ProjectsMGM_REPORTSMGM_REPORTSImportFile.mdf" failed with the operating system error 5(Access is denied.). Could not attach file 'C:Documents and Settingszimmerman_eMy DocumentsVisual Studio 2005ProjectsMGM_REPORTSMGM_REPORTSImportFile.mdf' as database 'dbname'." Number=5133 Procedure="" Server=".SQLExpress" Source=".Net SqlClient Data Provider" State=1 StackTrace: at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at MGM_REPORTS.DbConnect.InsertSQL(String[] Values) in C:Documents and Settingszimmerman_eMy DocumentsVisual Studio 2005ProjectsMGM_REPORTSMGM_REPORTSDbConnect.vb:line 149 at MGM_REPORTS.DbConnect.btnConnectDB_Click(Object sender, EventArgs e) in C:Documents and Settingszimmerman_eMy DocumentsVisual Studio 2005ProjectsMGM_REPORTSMGM_REPORTSDbConnect.vb:line 21 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at MGM_REPORTS.DbConnect.Main() in C:Documents and Settingszimmerman_eMy DocumentsVisual Studio 2005ProjectsMGM_REPORTSMGM_REPORTSDbConnect.vb:line 158 at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
I like to give First Name and Last Name in two different text box and then hit the delete button (command button). Then it will do a query to find the person and delete the corresponding record from the table. Any kind of help will be appreciated. Thank you.
Hi all, I'm new to SQL and have been trying to update a record in a table, something I imagine would be quite simple. The record holds a INT value and I wish to test the value to see if it is greater than 70, if it is....reset the value to 1
I have tried various methods, aiming at using a stored procedure that will run once a day at midnight.
Hello I need an alarm or raise an event from SQL Server after updating to get it in .net. I use SQL Server 2005 Express Edition and vb.net2 for my programming language. Suppose that in a windows form I have a grid and I'm working with this page another client is working with this same page .He is editing the information of a record of a grid and save it in database so I want to give an alarm or an event that raise from SQL Server (for example in a trigger) , what can I do? Thanks.
Hi, I have a problem, it is that when I try to update a record in my SQL server database, it is not updated and I recieve no error messages. This is the code behind the update button. The stored procedure is "sqlupdate".
Code Snippet
Dim ListingID As String = Request.QueryString("id").ToString Dim con As New SqlConnection(ListingConnection) Dim cmd As New SqlCommand("sqlupdate", con) cmd.CommandType = CommandType.StoredProcedure Dim id As SqlParameter = cmd.Parameters.Add("@id", SqlDbType.UniqueIdentifier) id.Direction = ParameterDirection.Input id.Value = ListingID
Dim PlaceName As SqlParameter = cmd.Parameters.Add("@PlaceName", SqlDbType.VarChar) PlaceName.Direction = ParameterDirection.Input PlaceName.Value = PlaceNameTB.Text
Dim Location As SqlParameter = cmd.Parameters.Add("@Location", SqlDbType.VarChar) Location.Direction = ParameterDirection.Input Location.Value = LocationTB.Text
Dim PropertyType As SqlParameter = cmd.Parameters.Add("@PropertyType", SqlDbType.VarChar) PropertyType.Direction = ParameterDirection.Input PropertyType.Value = PropertyTypeTB.Text
Dim Description As SqlParameter = cmd.Parameters.Add("@Description", SqlDbType.VarChar) Description.Direction = ParameterDirection.Input Description.Value = DescriptionTB.Text
Try con.Open() cmd.ExecuteNonQuery() con.Close() Catch ex As Exception
I'm using VB.Net 2008 with SQL Compact 3.5. After trying forever, I finally got my app to open a retrieve a record from a table. Now, when I try to update the record, I get an error on the ExecuteNonQuery statement. The error says I am "attempting to read or write protected memory". The code works perfectly with an Access database.
Hello, i currently have a gridview component displaying data from a SQLSERVER2005 database. I have created an 'edit' hyperlink on each record so that when pressed, the primary key of a record is sent in the querystring to another page when pressed. example http://localhost/Prog/EditAppointment.aspx?AppointmentId=1 In the edit page, i have dragged and dropped a sqldatasource that contains the select and update statements. i would now like to use textboxes and dropdowns to display the data for the particular record selected (in this case appointmentid=1). however i dont want to use a formview or automated component, just to drag and drop the textboxes myself. how do i bind the textboxes in the HTML code to the data from the select statement? My current select parameters look as follows. <SelectParameters> <asp:QueryStringParameter Name="AppointmentId" QueryStringField="AppointmentId" Type="Int32" /> <asp:ControlParameter ControlID="Textbox1" Name="PatientNo" PropertyName="Text" Type="String" /> </SelectParameters> Perhaps there is an error in my select parameters or does the problem lay elsewhere? Any help would be appreicated. Thanks, James.
The process of adding a column with DEFAULT (0) to a table that has 15million records takes a despicable amount of time (too much time) and the transaction log of the database grew to an unacceptable size. I would like to accomplish the same task using this procedure:
·Add the column to the table with null value. ·Loop through the table (500000 records at a time) and SET the value in the newly added column to 0. ·Issue a commit statement after each batch ·Issue a checkpoint statement after each batch. ·Alter the table and SET the column to NOT Null DEFAULT (0)
Here is my Sample script
ALTER TABLE EMPLOYEE ADD EZEVALUE NUMERIC (9,6) NULL Go
Loop UPDATE EMPLOYEE SET EZEVALUE = 0 Commit Tan CHECKPOINT END (Repeat the loop until the rows in EMPLOYEE have the value 0)
Go
ALTER TABLE EMPLOYEE ALTER COLUMN EZEVALUE NUMERIC (9,6) NOT NULL DEFAULT (0)
My problem is with the loop section of this script. How do I structure the loop section of this script to loop through the employee table and update the EZEVALUE column 500000 rows at a time, issue a Commit Tran and a CHECKPOINT statement until the whole table has been updated. Does anyone out there know how to accomplish this task? Any information would be greatly appreciated.
pls i have asp.net page that i want to connect to sql server express edition database and i want data to be submited from the page into sql server express edition database that i have in my project folder when i click on submit button pls help me with the code to do this
Hi People, hope someone can help me out here with a little problem. Basically i've go a asp.net page which has a listbox on. This list box is populated from a SQL database table with the datetime of the a selected field. Thus in the list box you get a list of strings looking like this "24/09/07 12:58" Also on the page is a submit button, and some other editing textboxes. The main issue here is the when the submit button is used i get the currently selected listbox timedate string and then pass this along with other items to update a record in the database based on the datetime in the listbox control.
Below is how i get the string from the listbox control Dim except_time As DateTime except_time = DropDownList1.SelectedValue The expect_time is then passed to store procedure along with some other vars, which looks like this -- =============================================-- Author: Lee Trueman-- Create date: 1st Sept 2007-- =============================================CREATE PROCEDURE [dbo].[spExcept_UpdateData] -- Add the parameters for the stored procedure here @validated bit, @update_time datetime, @except_time datetimeASBEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON -- Insert statements for procedure here UPDATE exceptions SET validated = @validated, update_time = @update_time WHERE (except_time = @except_time)END So validated and update_time should be updated when except_time is equal to @except_time
My problem is that the database never updates. If i debug the asp.net page the watch var shows the datetime in US format (I.e "09/24/07 12:58"), if this is true then this would explain why when it is passed to the stored proc nothing gets updated, as there would not be a date match. can anyone see any silly mistakes i'm doing here ????
I am trying to write a stored procedure that updates a value in a table based on the sort order. For example, my table has a field "OfferAmount". When this field is updated, I need to resort the records and update the "CurrRank" field with values 1 through whatever. As per my question marks below, I am not sure how to do this.
Update CurrRank = ??? from tblAppKitOffers where appkitid = 3 AND (OfferStatusCode = 'O' OR OfferStatusCODE = 'D') ORDER BY tblAppKitOffers.OfferAmount Desc
Hi, I need help with updating a record. When I run the following code underneath the update button, the record does not update and I get no error message. Anyone have any ideas?
Code Snippet
Dim ListingID As String = Request.QueryString("id").ToString Dim Description As String = DescriptionTB.Text Dim PlaceName As String = PlaceNameTB.Text Dim Location As String = LocationTB.SelectedValue Dim PropertyType As String = LocationTB.SelectedValue Dim Price As Integer = PriceTB.Text Dim con As New SqlConnection(ListingConnection)
Dim sql As String = "Update Listings SET Description = ?, PlaceName = ?, Location = ?, PropertyType = ?, Price = ? WHERE ListingID = ?" Dim cmd As New SqlCommand(Sql, con)
I created a package in SSIS to export data from mutiple SQL server tables to a single flat file. Once the export is completed i need to update 2 tables ( a batch table and a history table) In the batch table I need to insert a record with batch # (system generated),batch date, status( success/failed), record count( no of records in the flat file), batch filename). In the history table, i need to insert a record for each of the rows in the flat file with the foll info. batch number,datetime,status(success/failed)
My question is how do I get the batch status,record count, batchfilename for batch table update and how do i get to update the history table.
BTW, i am executing this package as a SQL Server Agent job. I am new to Integration Services and feel lost. Any help ?
I just got a dedicated server to run my websites and SQL Server and MS SQL 2005 Express was installed as it will be more then enough to handle the needs of my DBs right now. The problem I am getting is that when I try to connect to the server from Management Stuido Exrpess (from the server it's self) I recive this error:
quote:provider: Named Pipes Provider, error:40 - Could not open a connection to SQL Server Microsoft SQL Server, Error: 2
And when from a remote computer I get: quote:provider: Named Pipes Provider, error:40 - Could not open a connection to SQL Server Microsoft SQL Server, Error: 53
I have gone into the Service Area Configuration and made sure that it is set to accept TCP/IP and Named Pipes connection from remote computers and then restarted the dataebase engine.
Can anyone help me? Since this is a dedicated server I have to pay for there support and want to see if I can avoide that
-- If I get used to envying others... Those things about my self I pride will slowly fade away. -Stellvia
HI all, I have a windows application which runs a process,
I am updating database column "Status" with Processing when the application is running, and on completion I update it with Staus="Completed" or in case I close the application I update db with Status="Interupted" .
I have problem that in case while proces is running, power supply or system turns off, the db Status="Processing", but in actual it is interupted. How will i update?
Inside a single transaction I'm inserting/updating multiple records into multiple tables, in this order: table 1 record 1 table 2 record 1 table 3 record 1 table 1 record 2 table 2 record 1 table 1 record 3 table 2 record 3 table 3 record 3
Now I'm getting an unspecified error on a certain table:
Indicates a data modification, such as an insert, an update, or a deletion. Ensures that multiple updates cannot be made to the same resource at the same time. (I assume that multiple updates within the SAME transaction can be made, only multiple updates from different transaction cannot be made, right?) I cannot find any reference to this error message and don't know what the numbers mean. Maybe it relates to data that can be found in the sys.lock_information table like explained here, http://technet.microsoft.com/en-us/library/ms172932.aspx, but I'm not sure.
Furthermore, the sys.lock_information table is empty. I haven't been able to reproduce the problem myself. I only received an error log and the database to investigate it.
So, does anybody have an idea what this error message means and what I can do to troubleshoot this?
Hi. i created a small database with a table to store two numbers and the sum. num1,num2 and sum column. In sql i used the computed columns specification to assign sum as num1+num2.
running the database, everything works fine. i input the numbers and the sum is auto calculated.
i try to do same thing by bring the table in a vb 2008 form using a datagrid view. when i run the application i can just enter the two values(num1 and num2) in the datagrid but the sum is not calculated despite pressing enter or tab and also the data entered is not saved.
Hello, I have a datagridview setup right now to display data from one table in my database. However, I am going to need it to pull certain columns from certain tables and put them all into one datagrid. The three tables are demographics, financial, and procedures. Can someone give me an example on how I'd go about doing this? I'm using vb.net.
The procedures table is a list of options that will be displayed in a combo box, depending on the option selected, other cells in the datagrid will be filled with certain data, this data is in the procedures table as well. All of this data will be alongside a customer id located in the demographics table, and will all be recorded into the financial table.
I am sorry for asking such a broad question, but I have been working on this and from what I can gather it can be done. My problem is that much of it has gone right over my head and I am getting more confused the more I read... I'm really, really confused...
Basically, I have a dataGridView that is populated with a number of fields from Table1 (ID, NameID, Status, Phone, Notes). This works fine, BUT I would like to access Table2 and have, where ID in Table2 = NameID in Table1, it load the First Name & Last Name into the dataGridView. I am able to load the information from Table 2 like so: SELECT NameFirst + ' ' + NameLast from Table2", but I can't get both Tables to work correctly.
I would like the dataGridView to be layed out like this:
ID NameID Name (NameFirst + NameLast) Status Phone Notes
I can't for the life of me understand or get this to work (Or for that matter even understand what I am trying to do...
Also, I am using Access 2007.
I would greatly appreciate some help, and possibly some explanation in laymans terms so that I might be able to understand this. I have read a lot about this, but for whatever reason it is just soooooo over my head that I can't follow it whatsoever.
// create and open the connection OleDbConnection conn = new OleDbConnection(conString); OleDbCommand command = new OleDbCommand(); command = conn.CreateCommand();
// create the DataSet DataSet ds = new DataSet();
// run the query command.CommandText = "SELECT ID AS [#], NameID AS [Name], Status AS [Status], Phone AS [Phone], Notes AS [Notes] FROM Table1 WHERE ID = " + textBox13.Text + ";"; OleDbDataAdapter adapter = new OleDbDataAdapter(); adapter = new OleDbDataAdapter(command); adapter.Fill(ds);
// close the connection conn.Close();
bindingSource1.DataSource = ds.Tables[0];
dataGridView1.DataSource = bindingSource1;
// set the size of the dataGridView Columns this.dataGridView1.Columns[0].Width = 10; this.dataGridView1.Columns[1].Width = 100; this.dataGridView1.Columns[2].Width = 100; this.dataGridView1.Columns[3].Width = 100; this.dataGridView1.Columns[4].Width = 176;
I am creating a windows application that is not going to be used in a controlled environment like a LAN or some other network, so I want to include a local database in the install of this app. Ideally, I would like to use SQL 2005 Express like you would MSDE or Access, but I am not sure if the user must have SQL Server installed on their machine in order for this to work and I don't have a machine without it to test on.