Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all 2535 articles
Browse latest View live

Questions about Bindingsource.EndEdit and BindingSource.AddNew

$
0
0

Hello-

I am currently working on a piece of code (windows Forms in VB (VS 2010)) that is already in production and using bindingnavigator/tableadapter/bindingsource to cycle thru the data (they are using text boxes to display/edit the information) and this seems to work just fine.

Recently they wished to include an add item feature to it as well and while this seemed to be relatively forward I have run into an issue:  

Within the Save event  I used the following code

-----------------------------------------------------------------------------------------------------------

Private Sub SaveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveButton.Click

    ' Save item

 Try 
     Me.Validate()

  recordBindingSource.EndEdit()
     recordTableAdapter.Update(WISPatruLI_DataDataSet.Record)

       MsgBox("Update successful!")

 Catch ex As Exception
  MsgBox(ex.message)
        End Try
   
End Sub

-----------------------------------------------------------------------------------------------------------

But this continues to throw errors (at recordBindingSource.EndEdit()) related to the guid being Null.  I have no control over the DB side of things, outside of just writing a SQL to insert the new record , is there way to overcome this using the above controls ?

Thank you in advance for any help.

Ken


Is it possible to add a ComboBox with unique sets of data to each cell of a giving grid, using a datatable?

$
0
0

Sorry if this does not make sense, but I am new to C# and WPF...

I have a case where I need to have a potentially different set of data for any giving cell of a grid...

In the example code I show below, I tried to create a DataTable with a column that is a typeof(ComboBox) and then create and add a ComboBox to the item.

Here is my code:


private void btnFill_Click(object sender, RoutedEventArgs e) { // Create a new data table DataTable dt = new DataTable(); // Create and add the columns DataColumn c1 = new DataColumn("UserId", typeof(ComboBox)); DataColumn c2 = new DataColumn("Age", typeof(Int32)); DataColumn c3 = new DataColumn("BirthDay", typeof(DateTime)); dt.Columns.Add(c1); dt.Columns.Add(c2); dt.Columns.Add(c3); ComboBox cbo1 = new ComboBox(); cbo1.Items.Add("One"); cbo1.Items.Add("Two"); cbo1.Items.Add("Three"); cbo1.SelectedIndex = 0; // Add your data - one row at a time DataRow newRow = dt.NewRow(); newRow["UserId"] = cbo1; newRow["Age"] = 24; newRow["BirthDay"] = DateTime.Today.AddYears(-24); dt.Rows.Add(newRow);

cbo1.Items.Clear(); cbo1.Items.Add("Four"); cbo1.Items.Add("Five"); cbo1.Items.Add("Six"); cbo1.SelectedIndex = 0; newRow = dt.NewRow(); newRow["UserId"] = cbo1; newRow["Age"] = 74; newRow["BirthDay"] = DateTime.Today.AddYears(-74); dt.Rows.Add(newRow); // Turn off auto column generation grdData.AutoGenerateColumns = true; // Clear current columns grdData.Columns.Clear(); // Bind the grid grdData.ItemsSource = dt.DefaultView; }

The program is executed without any errors, but I just get the object string in the cell I expected to see the combo box:


I have found many examples of people using DataGridComboBoxColumn() object for setting the entire column equal to a combo Box with specific set of inputs, but in my case, the inputs may vary. So I could not figure out how to work that object into my logic.

Thanks in advance for any help that can be provided!!


Regards,

Patrick




How to display row numbers in GridView,urgently required

$
0
0
Hi,

I need this very badly.

I am using a datagridview for which the datasource is a dataview. This dataview is assigned with a datatable from database.

I am able to display the row numbers for the gridview by adding new column like shown below:

            int rowcount = table1.Rows.Count;
            table1.Columns.Add(new DataColumn("SNO", typeof(int)));

            for (int i = 1; i <= rowcount; i++)
            {
                table1.Rows[i - 1]["SNO"] = i;
            }

But main problem arised when i sort any another colum , the "SNO" also gets sorted with row numbers not in proper order. Like if I sort by name then row numbers are displyed like 3,2,1 ..

Even when i use Dataview's row filter, only few columns are displayed with previous rownumbers. Suppose, after row filter we are left with only last two columns, then the Row numbers are displayed as 2,3 but '1' is missing because it was filtered in rowfilter.

But I want 1,2 to be displayed there.

Please can any one help. Thanks in Advance,

Sukanya.


bindingsource.addnew does not set dataset.has changes = true

$
0
0

I am getting data from an Excel spreadsheet and attempting to add records to an access database.  I have been successful programmatically adding records to other tables in the database with the method below.  It doesn't work with this table.

        Dim sqlConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & data_path
        Dim sqlConnection As New OleDb.OleDbConnection(sqlConnectionString)
        sqlConnection.Open()
        ChecksTableAdapter.Connection = sqlConnection
        ChecksBindingSource.DataSource = ChecksTableAdapter.GetData
        ChecksBindingSource.AddNew()
        ChecksBindingSource.Current("check_number") = "FWD"
        xlCells = oXLSheet.Cells(first_row, DATE_COL + 1)
        cell_text = CStr(xlCells.Value)
        ChecksBindingSource.Current("check_date") = cell_text
        ChecksBindingSource.Current("payee") = ""
        ChecksBindingSource.Current("payment") = ""
        ChecksBindingSource.Current("deposit") = ""
        ChecksBindingSource.Current("balance") = initial_balance
        ChecksBindingSource.Current("comment") = ""
        ChecksBindingSource.Current("payment_value") = 0
        ChecksBindingSource.Current("deposit_value") = 0
        ChecksBindingSource.EndEdit()
        If Me.ChecksDataSet.HasChanges Then
            Try
                Me.Validate()
                Me.ChecksBindingSource.EndEdit()
                Me.ChecksTableAdapter.Update(Me.ChecksDataSet.checks)
                MsgBox("Update successful")
            Catch ex As Exception
                'FindErrors()
                MsgBox("Update failed")
            End Try
        End If

Me.ChecksDataSet.HasChanges never true

Where should I look now?  An UpdateCommand has been added to the checksTableAdapter by the wizard.


RONATMOODYLAKE

Regex for TSQL Columns of View

$
0
0

This Script:

CREATE VIEW [dbo].[FAHRAUFTRAGZIEL]

(   ANFAHRSTELLEID,

   FAHRAUFTRAGID,

   FIRMENNR,

   SEQ,

   UUID,

   ADRESSENID,

   ADRESSEN_NUMMER,

   ANFAHRSTELLE_NUMMER,

   ANFAHRSTELLE_NAME,

   ANFAHRSTELLE_ANSCHRIFT,  

  FAHRAUFTRAG_NUMMER

)

AS   

SELECT   

    FAHRAUFTRAGZIEL_T.ANFAHRSTELLEID,  

     FAHRAUFTRAGZIEL_T.FAHRAUFTRAGID,  

     FAHRAUFTRAGZIEL_T.FIRMENNR,   

    FAHRAUFTRAGZIEL_T.SEQ,  

     FAHRAUFTRAGZIEL_T.UUID,  

     ANFAHRSTELLE_T.ADRESSENID,

      ADRESSEN_T.NUMMER AS ADRESSEN_NUMMER,

      ANFAHRSTELLE_T.NUMMER AS ANFAHRSTELLE_NUMMER,   

    anfAnschrift.NAME AS ANFAHRSTELLE_NAME,  

     anfAnschrift.ANSCHRIFT AS ANFAHRSTELLE_ANSCHRIFT,  

     FAHRAUFTRAG_T.NUMMER AS FAHRAUFTRAG_NUMMER

   FROM

      dbo.FAHRAUFTRAGZIEL_T  

      INNER JOIN dbo.ANFAHRSTELLE_T ON ANFAHRSTELLE_T.UUID = FAHRAUFTRAGZIEL_T.ANFAHRSTELLEID  

        INNER JOIN dbo.ANSCHRIFT_T  AS anfAnschrift ON anfAnschrift.UUID = ANFAHRSTELLE_T.ANSCHRIFTID      

    INNER JOIN dbo.ADRESSEN_T ON ADRESSEN_T.UUID = ANFAHRSTELLE_T.ADRESSENID

         INNER JOIN dbo.FAHRAUFTRAG_T ON FAHRAUFTRAG_T.UUID = FAHRAUFTRAGZIEL_T.FAHRAUFTRAGID

Should look like this with Regex:

dbo.FAHRAUFTRAGSZIEL

maybe useless cause i know the View-Name

of SELECT-Block:

FAHRAUFTRAGZIEL_T.ANFAHRSTELLEID

FAHRAUFTRAGZIEL_T.FAHRAUFTRAGID

FAHRAUFTRAGZIEL_T.FIRMENNR

FAHRAUFTRAGZIEL_T.SEQ

FAHRAUFTRAGZIEL_T.UUID

ANFAHRSTELLE_T.ADRESSENID

ADRESSEN_T.NUMMER

ANFAHRSTELLE_T.NUMMER

anfAnschrift.NAME

anfAnschrift.ANSCHRIFT

FAHRAUFTRAG_T.NUMMER

of FROM-Block

dbo.FAHRAUFTRAGZIEL_T

dbo.ANFAHRSTELLE_TAN

FAHRSTELLE_T.UUID

FAHRAUFTRAGZIEL_T.ANFAHRSTELLEID

dbo.ANSCHRIFT_T

anfAnschrift.UUID

ANFAHRSTELLE_T.ANSCHRIFTID

dbo.ADRESSEN_T

ADRESSEN_T.UUID

ANFAHRSTELLE_T.ADRESSENID

dbo.FAHRAUFTRAG_T

FAHRAUFTRAG_T.UUID

FAHRAUFTRAGZIEL_T.FAHRAUFTRAGID

That means the Regex hav to be Match : (Word).(Word)

AND A WORD CAN ONLY BE LETTERS AND UNDERSCORE !!!

So I did this:

 Regex regCol = new Regex(@"[A-Za-z_].*\.[A-Za-z_].*"); MatchCollection matchesCol = regCol.Matches(sqlScript);


But the result set was not the same i expected:

Per Examples some matches out of the generated regex matchcollection

{FAHRAUFTRAGZIEL_T.ANFAHRSTELLEID, }

{FAHRAUFTRAGZIEL_T.FAHRAUFTRAGID, }

{FAHRAUFTRAGZIEL_T.FIRMENNR, }

{FAHRAUFTRAGZIEL_T.SEQ, }

{FAHRAUFTRAGZIEL_T.UUID, }

{ANFAHRSTELLE_T.ADRESSENID, }

{ADRESSEN_T.NUMMER AS ADRESSEN_NUMMER, }

{ANFAHRSTELLE_T.NUMMER AS ANFAHRSTELLE_NUMMER, }

{INNER JOIN dbo.ANFAHRSTELLE_T ON ANFAHRSTELLE_T.UUID = FAHRAUFTRAGZIEL_T.ANFAHRSTELLEID }

{INNER JOIN dbo.ANSCHRIFT_T  AS anfAnschrift ON anfAnschrift.UUID = ANFAHRSTELLE_T.ANSCHRIFTID }

{INNER JOIN dbo.ADRESSEN_T ON ADRESSEN_T.UUID = ANFAHRSTELLE_T.ADRESSENID }

The Question is: why the fuck are there floating points and whitespaces

and I need some advice, help or something else :D Thanks in Advance



Why method doesn't execute?

$
0
0

Hello. I have a problem. Obviously ;)
So, I have a method that update and refresh datatable in one form. If I "connect" this method to button in same form (form1) it works fine, but if I "connect" it to a button in another form (Form2) same process doesn't work. does anybody know why?

Here is some code:

Form1:

public void RefreshTabel()
        {
            gTableAdapter.Update(ds.Growns);
            this.gTableAdapter.Fill(this.ds.Growns);
        }

Form 2:

private void buttonSave_Click(object sender, EventArgs e)
        {
            Form1 form1 = new Form1();
            form1.RefreshTabel();
        }

Thanks for help.

How to make a login system in VB 2010

$
0
0

Hello everyone, Yimi167 here with a new question.

I'm a bit rusty at vb studio and programming in general, however let me start to explain. I'm looking to make a login system in vb 2010 that would be able to do the following: Check database for the name and password verify it and then login to what ever.

I also need a registration form that asks for the following: username, password and email. Then verifies that the email and username are not taken then create that account. I want it added not only to the login database, but also in a .txt file. I also wanna know how to add info to this .txt file for invantory, bank and so on... and make it so that all the databases I need will read this .txt file upon login to load all this data.

And lastly I wanna it to read image files for tiles and sprites; how can I make this?

This is all the info I'll need to get started. Please be clear in your descriptions. I will love you all bunches when I get this figured out (expect more questions in the future). 

C# App connecting to an Access DB File - error - System.Runtime.InteropServices.SEHException: External component has thrown an exception.

$
0
0

Good Day

I have an application written in C#, that connects to a Microsoft Access Database file.

Now, the enviroment is (Windows 7 - 64bit, with MS Office 32 Bit.

After some research, i came to a solution that advised installed - AccessDatabaseEngine.exe /Passive and then going to the registery and renaming the entry MSO.DLL

I did this and the app worked perfect!!,

then somehow randomly months later i started getting the following error, adn just cannot find a solution.

error below.

See the end of this message for details on invoking

just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************

System.Runtime.InteropServices.SEHException: External component has thrown an exception.

at System.Data.OleDb.DataSourceWrapper.InitializeAndCreateSession(OleDbConnectionString constr, SessionWrapper& sessionWrapper)

at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)

at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)

at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)

at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)

at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)

at System.Data.OleDb.OleDbConnection.Open()

at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState)

at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)

at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)

at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)

at BalRecon.reconDataSetTableAdapters.cutsTableAdapter.Fill(cutsDataTable dataTable) in C:\Users\Mohamed\Documents\Balances App - Pep\x64\BalRecon\reconDataSet.Designer.cs:line 1494

at BalRecon.Form1.Form1_Load(Object sender, EventArgs e) in C:\Users\Mohamed\Documents\Balances App - Pep\x64\BalRecon\Form1.cs:line 49

at System.Windows.Forms.Form.OnLoad(EventArgs e)

at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)

at System.Windows.Forms.Control.CreateControl()

at System.Windows.Forms.Control.WmShowWindow(Message& m)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

************** Loaded Assemblies **************

mscorlib

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)

CodeBase:

file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll

----------------------------------------

BalRecon

Assembly Version: 1.0.0.0

Win32 Version: 1.0.0.0

CodeBase:

file:///C:/Line%20Balance/BalRecon.exe

----------------------------------------

System.Windows.Forms

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)

CodeBase:

file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

----------------------------------------

System

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)

CodeBase:

file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

----------------------------------------

System.Drawing

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)

CodeBase:

file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

----------------------------------------

System.Data

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)

CodeBase:

file:///C:/Windows/assembly/GAC_64/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll

----------------------------------------

System.Xml

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)

CodeBase:

file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll

----------------------------------------

System.Data.DataSetExtensions

Assembly Version: 3.5.0.0

Win32 Version: 3.5.30729.5420 built by: Win7SP1

CodeBase:

file:///C:/Windows/assembly/GAC_MSIL/System.Data.DataSetExtensions/3.5.0.0__b77a5c561934e089/System.Data.DataSetExtensions.dll

----------------------------------------

System.Core

Assembly Version: 3.5.0.0

Win32 Version: 3.5.30729.5420 built by: Win7SP1

CodeBase:

file:///C:/Windows/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll

----------------------------------------

Accessibility

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)

CodeBase:

file:///C:/Windows/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll

----------------------------------------

System.Configuration

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)

CodeBase:

file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

----------------------------------------

System.Transactions

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)

CodeBase:

file:///C:/Windows/assembly/GAC_64/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll

----------------------------------------

************** JIT Debugging **************

To enable just-in-time (JIT) debugging, the .config file for this

application or computer (machine.config) must have the

jitDebugging value set in the system.windows.forms section.

The application must also be compiled with debugging

enabled.

For example:

<configuration>

<system.windows.forms jitDebugging="true" />

</configuration>

When JIT debugging is enabled, any unhandled exception

will be sent to the JIT debugger registered on the computer

rather than be handled by this dialog box.

 Any ideas?


AMI.NET


Save all records DATA Grid view by typing in it

$
0
0

Hi, can somebody help me about Save all records DATA Grid view by typing in it. I'm using vb 2010..


for example i have a grid and i type the records there after going to the next row it will be saved to the database.. I'm using MSSQL 2008 for the DB. I tried this one

Private Sub frmsetting_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.UtOTratesTableAdapter.Fill(Me._88PayrollDataSet.utOTrates)

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.UtOTratesTableAdapter.Update(Me._88PayrollDataSet.utOTrates)
    End Sub

 but I received this error:Update requires a valid UpdateCommand when passed DataRow collection with modified rows.



What control can I use to mimic the record selector within an Access Database

$
0
0

I'm updating an older access application to a C# 3.5 winforms application.  I would like to mimic the way I can bind data to a record selector and when I cycle through the records the data within the textboxes and dropdownlists updates based on the record selected.  What is the best way to achieve this?  For now i'm going to use the old access back end database to bind to my form.  

Thank you

Form with Autoscroll Focus on Datagridview triggers scroll

MS-Access C# Updating Data to the Database

$
0
0

I use MS-Access Database using C# for my Windows Forms Application

I have the Following two combo boxes 1 combo box with EEID-Unique ID and Employee name I have a 2nd Combo box with a list of employee statuses example: Current Employee, Other, Terminated. I want to update the status of the employee by the value selected in combobox2. I have the following in Code and I dont get any errors, it doesn't update the employees status?

I have tried both of the following an neither work


            using (OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\srye\Desktop\MSaccess\Employee Database - Copy2.accdb"))
            {
                con.Open();
                OleDbCommand cmd = new OleDbCommand(@"UPDATE tblExsitingEEs SET  tblExsitingEEs.Status= ? where (tblExsitingEEs.eeid= ?)", con);
                cmd.Parameters.Add("@Status", OleDbType.VarChar).Value = cmbStatus.SelectedValue.ToString();
                cmd.Parameters.Add("@eeid", OleDbType.VarChar).Value = cmbEmployee.SelectedValue.ToString();
                cmd.ExecuteNonQuery();
                con.Close();
            }


            using (OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\srye\Desktop\MSaccess\Employee Database - Copy2.accdb"))
            {
                con.Open();
                OleDbCommand cmd = new OleDbCommand(@"UPDATE tblExsitingEEs SET  tblExsitingEEs.Status= ? where (tblExsitingEEs.eeid= ?)", con);
                cmd.Parameters.Add("@eeid", OleDbType.VarChar).Value = cmbEmployee.SelectedValue.ToString();
                cmd.Parameters.Add("@Status", OleDbType.VarChar).Value = cmbStatus.SelectedValue.ToString();
                cmd.ExecuteNonQuery();
                con.Close();
            }


shawnrye

How I can reload my dataGridView ?

$
0
0

http://social.msdn.microsoft.com/Forums/windows/en-US/ff091d1a-c446-472f-b51e-37f2b9cd3b54/how-i-can-refresh-my-datagridview-from-another-form?referrer=http://social.msdn.microsoft.com/Forums/windows/en-US/ff091d1a-c446-472f-b51e-37f2b9cd3b54/how-i-can-refresh-my-datagridview-from-another-form?referrer=http://social.msdn.microsoft.com/Forums/windows/en-US/ff091d1a-c446-472f-b51e-37f2b9cd3b54/how-i-can-refresh-my-datagridview-from-another-form

In this link there is a code. It works fine when I use sql server.

But I used MS- access database. Then it will not working.


public partial class Form1 : Form { public Form1() { InitializeComponent(); } public static SqlConnection getc() { string sqlstr = "Data Source=.;Initial Catalog=pp1;Integrated Security=True"; SqlConnection conn = new SqlConnection(sqlstr); return conn; } private DataTable GetData() { DataTable dt = new DataTable(); using (SqlConnection conn = getc()) { SqlCommand cmd = new SqlCommand("select * from dgv", conn); conn.Open(); SqlDataAdapter ad = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); ad.Fill(ds); dt = ds.Tables[0]; return dt; } } private void Form1_Load(object sender, EventArgs e) { dataGridView1.DataSource = GetData(); } private void button1_Click(object sender, EventArgs e) { Form2 fm = new Form2(); fm.RefreshDgv += new Form2.DoEvent(fm_RefreshDgv); fm.Show(); } void fm_RefreshDgv(string a, string b, string c) { using (SqlConnection conn = getc()) { SqlCommand cmd = new SqlCommand("insert into dgv values(@a,@b,@c)", conn); cmd.Parameters.AddWithValue("@a", a); cmd.Parameters.AddWithValue("@b", b); cmd.Parameters.AddWithValue("@c", c); conn.Open(); cmd.ExecuteNonQuery(); dataGridView1.DataSource = GetData(); } } }


Buy X Get Y Free scheme Logic

$
0
0

Hi,

I have some items with MRP. I want to apply some offer to this items like

Buy 1 Get 1 Free/Buy 2 get 1 Free / Buy 1 Get 2 Free, etc.

Suppose 1 Customer buying 2 items such as,(these items are added in Gridview.)

Itemcode   MRP

001            200

002             120

So if i am applying the Scheme (Buy 1 Get 1 Free), It will apply 100% discount to the Cheaper item i.e. item 002.

Can any one give some logic to appy this.

thanks and regards,

Sanjaya kumar mohapatra

VB.Net - DataGridView - Image

$
0
0

Hello, I'm beginner for VB.Net, I put several image file paths in Access database column,

(Database has few column ID, Name, FilePath)

I want to show all the data in DataGridview with Image (Not file path)

Its like,

ID, Name and Image-----------> 1st row details

ID, Name and Image-----------> 2nd row details

I read some articles, but I really not understand how to do this, from its I can load single image in to DataGrid its like this,

Dim NewImage As New DataGridViewImageColumn()
Dim Pics As Image = Image.FromFile("C:\Users\Public\Pictures\Sample Pictures\Tulips.jpg")
NewImage.Image = Pics
DataGridView1.Columns.Add(NewImage)
NewImage.HeaderText = "Photo"
DataGridView1.DataSource = ds.Tables(0)
but I need another thing to do, Please help somebody to do this.

Combobox has been populated, would like to use this information to populate databound texboxes

$
0
0

I have a combobox which has been populated from an sql query with datareader.

I then have databound textboxes on the screen which I would like to have their text changed based on the scrolling through the combobox. 

The combobox's values will change based on other criteria...but the value is a number which is a unique identifier of each field.

combobox contains a contract number which is unique. and the textboxes contain other information like person who signed the contract, date, place ....all specific to each contract number.

Any help would be very much appreciated!


how to show true false in place of 1 and 0 from a tinyint type of col . windows 2005

$
0
0

hi,

I  a column tinyint having 1,0 , i want to show true and false in gridview, or datatable.

please tel me how i accomplish the task.

yours sincerly.

Creating a form within a form.

$
0
0

Hello,

I have a project that has a binding Navigator and I have it binding to certain fields on the main form.  I want to create a subform that is visible on the main form.  When the user changes records I want the data within the subform to also change based on a value in the main form.   It is like Microsoft access and the subform control.  If I am doing it incorrectly and there is a cleaner way please let me know.

Thank you for any help.

Need "display value" and "actual value" from an UN-bond combobox

$
0
0

I can see that this can be done if you look up the data from a data table, but I have a lot of simple unchanging options list which do not need to be soft coded in the database. However, I want to store a simple code and not a full description of the item.

The combobox's collection gives a list that is displayed and the "value" of each item is the same. I am look for the collection to be

<ID1> <display item>

<ID2> <display item>

Where the combo box shows the <display item>s, but the "value" of the field is <ID?>

 Any ideas?


Don C

sharepoint combox binding to list and excel web part to link to excel wordbook

$
0
0

i want to create a share point site and want to display a combo box there. this combo box box can have value as 1,2,3. according to the value selected in combo box, I want to display the data in list present at the pages of sharepoint site.

on some pages I have webpart which displays the excel table views. According to the value selected in combo box, I want to do dynamic linking to the excel. I would be having multiple excels at documents location.

Viewing all 2535 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>