Search Results

Search found 3261 results on 131 pages for 'bong da city'.

Page 18/131 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • grep pattern interpretted differently in 2 different systems with same grep version

    - by Lance Woodson
    We manufacture a linux appliance for data centers, and all are running fedora installed from the same kickstart process. There are different hardware versions, some with IDE hard drives and some SCSI, so the filesystems may be at /dev/sdaN or /dev/hdaN. We have a web interface into these appliances that show disk usage, which is generated using "df | grep /dev/*da". This generally works for both hardware versions, giving an output like follows: /dev/sda2 5952284 3507816 2137228 63% / /dev/sda5 67670876 9128796 55049152 15% /data /dev/sda1 101086 11976 83891 13% /boot However, for one machine, we get the following result from that command: Binary file /dev/sda matches It seems that its grepping files matching /dev/*da for an unknown pattern for some reason, only on this box that is seemingly identical in grep version, packages, kernel, and hardware. I switched the grep pattern to be "/dev/.da" and everything works as expected on this troublesome box, but I hate not knowing why this is happening. Anyone have any ideas? Or perhaps some other tests to try?

    Read the article

  • Passing integer lists in a sql query, best practices

    - by Artiom Chilaru
    I'm currently looking at ways to pass lists of integers in a SQL query, and try to decide which of them is best in which situation, what are the benefots of each, and what are the pitfalls, what should be avoided :) Right now I know of 3 ways that we currently use in our application. 1) Table valued parameter: Create a new Table Valued Parameter in sql server: CREATE TYPE [dbo].[TVP_INT] AS TABLE( [ID] [int] NOT NULL ) Then run the query against it: using (var conn = new SqlConnection(DataContext.GetDefaultConnectionString)) { var comm = conn.CreateCommand(); comm.CommandType = CommandType.Text; comm.CommandText = @" UPDATE DA SET [tsLastImportAttempt] = CURRENT_TIMESTAMP FROM [Account] DA JOIN @values IDs ON DA.ID = IDs.ID"; comm.Parameters.Add(new SqlParameter("values", downloadResults.Select(d => d.ID).ToDataTable()) { TypeName = "TVP_INT" }); conn.Open(); comm.ExecuteScalar(); } The major disadvantages of this method is the fact that Linq doesn't support table valued params (if you create an SP with a TVP param, linq won't be able to run it) :( 2) Convert the list to Binary and use it in Linq! This is a bit better.. Create an SP, and you can run it within linq :) To do this, the SP will have an IMAGE parameter, and we'll be using a user defined function (udf) to convert this to a table.. We currently have implementations of this function written in C++ and in assembly, both have pretty much the same performance :) Basically, each integer is represented by 4 bytes, and passed to the SP. In .NET we have an extension method that convers an IEnumerable to a byte array The extension method: public static Byte[] ToBinary(this IEnumerable intList) { return ToBinaryEnum(intList).ToArray(); } private static IEnumerable<Byte> ToBinaryEnum(IEnumerable<Int32> intList) { IEnumerator<Int32> marker = intList.GetEnumerator(); while (marker.MoveNext()) { Byte[] result = BitConverter.GetBytes(marker.Current); Array.Reverse(result); foreach (byte b in result) yield return b; } } The SP: CREATE PROCEDURE [Accounts-UpdateImportAttempts] @values IMAGE AS BEGIN UPDATE DA SET [tsLastImportAttempt] = CURRENT_TIMESTAMP FROM [Account] DA JOIN dbo.udfIntegerArray(@values, 4) IDs ON DA.ID = IDs.Value4 END And we can use it by running the SP directly, or in any linq query we need using (var db = new DataContext()) { db.Accounts_UpdateImportAttempts(downloadResults.Select(d => d.ID).ToBinary()); // or var accounts = db.Accounts .Where(a => db.udfIntegerArray(downloadResults.Select(d => d.ID).ToBinary(), 4) .Select(i => i.Value4) .Contains(a.ID)); } This method has the benefit of using compiled queries in linq (which will have the same sql definition, and query plan, so will also be cached), and can be used in SPs as well. Both these methods are theoretically unlimited, so you can pass millions of ints at a time :) 3) The simple linq .Contains() It's a more simple approach, and is perfect in simple scenarios. But is of course limited by this. using (var db = new DataContext()) { var accounts = db.Accounts .Where(a => downloadResults.Select(d => d.ID).Contains(a.ID)); } The biggest drawback of this method is that each integer in the downloadResults variable will be passed as a separate int.. In this case, the query is limited by sql (max allowed parameters in a sql query, which is a couple of thousand, if I remember right). So I'd like to ask.. What do you think is the best of these, and what other methods and approaches have I missed?

    Read the article

  • Sending changes from multiple tables in disconnected dataset to SQLServer...

    - by Stecy
    We have a third party application that accept calls using an XML RPC mechanism for calling stored procs. We send a ZIP-compressed dataset containing multiple tables with a bunch of update/delete/insert using this mechanism. On the other end, a CLR sproc decompress the data and gets the dataset. Then, the following code gets executed: using (var conn = new SqlConnection("context connection=true")) { if (conn.State == ConnectionState.Closed) conn.Open(); try { foreach (DataTable table in ds.Tables) { string columnList = ""; for (int i = 0; i < table.Columns.Count; i++) { if (i == 0) columnList = table.Columns[0].ColumnName; else columnList += "," + table.Columns[i].ColumnName; } var da = new SqlDataAdapter("SELECT " + columnList + " FROM " + table.TableName, conn); var builder = new SqlCommandBuilder(da); builder.ConflictOption = ConflictOption.OverwriteChanges; da.RowUpdating += onUpdatingRow; da.Update(ds, table.TableName); } } catch (....) { ..... } } Here's the event handler for the RowUpdating event: public static void onUpdatingRow(object sender, SqlRowUpdatingEventArgs e) { if ((e.StatementType == StatementType.Update) && (e.Command == null)) { e.Command = CreateUpdateCommand(e.Row, sender as SqlDataAdapter); e.Status = UpdateStatus.Continue; } } and the CreateUpdateCommand method: private static SqlCommand CreateUpdateCommand(DataRow row, SqlDataAdapter da) { string whereClause = ""; string setClause = ""; SqlConnection conn = da.SelectCommand.Connection; for (int i = 0; i < row.Table.Columns.Count; i++) { char quoted; if ((row.Table.Columns[i].DataType == Type.GetType("System.String")) || (row.Table.Columns[i].DataType == Type.GetType("System.DateTime"))) quoted = '\''; else quoted = ' '; string val = row[i].ToString(); if (row.Table.Columns[i].DataType == Type.GetType("System.Boolean")) val = (bool)row[i] ? "1" : "0"; bool isPrimaryKey = false; for (int j = 0; j < row.Table.PrimaryKey.Length; j++) { if (row.Table.PrimaryKey[j].ColumnName == row.Table.Columns[i].ColumnName) { if (whereClause != "") whereClause += " AND "; if (row[i] == DBNull.Value) whereClause += row.Table.Columns[i].ColumnName + "=NULL"; else whereClause += row.Table.Columns[i].ColumnName + "=" + quoted + val + quoted; isPrimaryKey = true; break; } } /* Only values for column that is not a primary key can be modified */ if (!isPrimaryKey) { if (setClause != "") setClause += ", "; if (row[i] == DBNull.Value) setClause += row.Table.Columns[i].ColumnName + "=NULL"; else setClause += row.Table.Columns[i].ColumnName + "=" + quoted + val + quoted; } } return new SqlCommand("UPDATE " + row.Table.TableName + " SET " + setClause + " WHERE " + whereClause, conn); } However, this is really slow when we have a lot of records. Is there a way to optimize this or an entirely different way to send lots of udpate/delete on several tables? I would really much like to use TSQL for this but can't figure a way to send a dataset to a regular sproc. Additional notes: We cannot directly access the SQLServer database. We tried without compression and it was slower.

    Read the article

  • Ado.net Fill method not throwing error on running a Stored Procedure that does not exist.

    - by Mike
    I am using a combination of the Enterprise library and the original Fill method of ADO. This is because I need to open and close the command connection myself as I am capture the event Info Message Here is my code so far // Set Up Command SqlDatabase db = new SqlDatabase(ConfigurationManager.ConnectionStrings[ConnectionName].ConnectionString); SqlCommand command = db.GetStoredProcCommand(StoredProcName) as SqlCommand; command.Connection = db.CreateConnection() as SqlConnection; // Set Up Events for Logging command.StatementCompleted += new StatementCompletedEventHandler(command_StatementCompleted); command.Connection.FireInfoMessageEventOnUserErrors = true; command.Connection.InfoMessage += new SqlInfoMessageEventHandler(Connection_InfoMessage); // Add Parameters foreach (Parameter parameter in Parameters) { db.AddInParameter(command, parameter.Name, (System.Data.DbType)Enum.Parse(typeof(System.Data.DbType), parameter.Type), parameter.Value); } // Use the Old Style fill to keep the connection Open througout the population // and manage the Statement Complete and InfoMessage events SqlDataAdapter da = new SqlDataAdapter(command); DataSet ds = new DataSet(); // Open Connection command.Connection.Open(); // Populate da.Fill(ds); // Dispose of the adapter if (da != null) { da.Dispose(); } // If you do not explicitly close the connection here, it will leak! if (command.Connection.State == ConnectionState.Open) { command.Connection.Close(); } ... Now if I pass into the variable StoredProcName = "ThisProcDoesNotExists" And run this peice of code. The CreateCommand nor da.Fill through an error message. Why is this. The only way I can tell it did not run was that it returns a dataset with 0 tables in it. But when investigating the error it is not appearant that the procedure does not exist. EDIT Upon further investigation command.Connection.FireInfoMessageEventOnUserErrors = true; is causeing the error to be surpressed into the InfoMessage Event From BOL When you set FireInfoMessageEventOnUserErrors to true, errors that were previously treated as exceptions are now handled as InfoMessage events. All events fire immediately and are handled by the event handler. If is FireInfoMessageEventOnUserErrors is set to false, then InfoMessage events are handled at the end of the procedure. What I want is each print statement from Sql to create a new log record. Setting this property to false combines it as one big string. So if I leave the property set to true, now the question is can I discern a print message from an Error ANOTHER EDIT So now I have the code so that the flag is set to true and checking the error number in the method void Connection_InfoMessage(object sender, SqlInfoMessageEventArgs e) { // These are not really errors unless the Number >0 // if Number = 0 that is a print message foreach (SqlError sql in e.Errors) { if (sql.Number == 0) { Logger.WriteInfo("Sql Message",sql.Message); } else { // Whatever this was it was an error throw new DataException(String.Format("Message={0},Line={1},Number={2},State{3}", sql.Message, sql.LineNumber, sql.Number, sql.State)); } } } The issue now that when I throw the error it does not bubble up to the statement that made the call or even the error handler that is above that. It just bombs out on that line The populate looks like // Populate try { da.Fill(ds); } catch (Exception e) { throw new Exception(e.Message, e); } Now even though I see the calling codes and methods still in the Call Stack, this exception does not seem to bubble up?

    Read the article

  • VBScript Multiple folder check if then statement

    - by user2868186
    I had this working before just fine with the exception of getting an error if one of the folders was not there, so I tried to fix it. Searched for a while (as much as I can at work) for a solution and tried different methods, still no luck and my IT tickets are stacking up at work, lol, woohoo. Thanks for any help provided. Getting syntax error on line 60 character 60, thanks again. Option Explicit Dim objFSO, Folder1, Folder2, Folder3, zipFile Dim ShellApp, zip, oFile, CurDate, MacAdd, objWMIService Dim MyTarget, MyHex, MyBinary, i, strComputer, objItem, FormatMAC Dim oShell, oCTF, CurDir, scriptPath, oRegEx, colItems Dim FoldPath1, FoldPath2, FoldPath3, foldPathArray Const FOF_SIMPLEPROGRESS = 256 'Grabs MAC from current machine strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery _ ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True") For Each objItem in colItems MacAdd = objItem.MACAddress Next 'Finds the pattern of a MAC address then changes it for 'file naming purposes. You can change the FormatMAC line of the code 'in parenthesis where the periods are, to whatever you like 'as long as its within the standard file naming convention Set oRegEx = CreateObject("VBScript.RegExp") oRegEx.Pattern = "([\dA-F]{2}).?([\dA-F]{2}).?([\dA-F]" _ & "{2}).?([\dA-F]{2}).?([\dA-F]{2}).?([\dA-F]{2})" FormatMAC = oRegEx.Replace(MacAdd, "$1.$2.$3.$4.$5.$6") 'Gets current date in a format for file naming 'Periods can be replaced with anything that is standard to 'file naming convention CurDate = Month(Date) & "." & Day(Date) & "." & Year(Date) 'Gets path of the directory where the script is being ran from Set objFSO = CreateObject("Scripting.FileSystemObject") scriptPath = Wscript.ScriptFullName Set oFile = objFSO.GetFile(scriptPath) CurDir = objFSO.GetParentFolderName(oFile) 'where and what the zip file will be called/saved MyTarget = CurDir & "\" & "IRAP_LOGS_" & CurDate & "_" & FormatMAC & ".zip" 'Actual creation of the zip file MyHex = Array(80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0) For i = 0 To UBound(MyHex) MyBinary = MyBinary & Chr(MyHex(i)) Next Set oShell = CreateObject("WScript.Shell") Set oCTF = objFSO.CreateTextFile(MyTarget, True) oCTF.Write MyBinary oCTF.Close Set oCTF = Nothing wScript.Sleep(3000) folder1 = True folder2 = True folder3 = True 'Adds folders to the zip file created earlier 'change these folders to whatever is needing to be copied into the zip folder 'Folder1 If not objFSO.FolderExists("C:\Windows\Temp\SMSTSLog") and If not objFSO.FolderExists("X:\Windows\Temp\SMSTSLog") then Folder1 = false End If If objFSO.FolderExists("C:\Windows\Temp\SMSTSLog") Then Folder1 = "C:\Windows\Temp\SMSTSLog" Set FoldPath1 = objFSO.getFolder(Folder1) Else Folder1 = "X:\windows\Temp\SMSTSLog" Set FoldPath1 = objFSO.getFolder(Folder1) End If 'Folder2 If not objFSO.FolderExists("C:\Windows\System32\CCM\Logs") and If not objFSO.FolderExists("X:\Windows\System32\CCM\Logs") then Folder2 = false End If If objFSO.FolderEXists("C:\Windows\System32\CCM\Logs") Then Folder2 = "C:\Windows\System32\CCM\Logs" Set FoldPath2 = objFSO.getFolder(Folder2) Else Folder2 = "X:\Windows\System32\CCM\Logs" Set FoldPath2 = objFSO.getFolder(Folder2) End If 'Folder3 If not objFSO.FolderExists("C:\Windows\SysWOW64\CCM\Logs") and If not objFSO.FolderExists("X:\Windows\SysWOW64\CCM\Logs") then Folder3 = false End If If objFSO.FolderExists("C:\Windows\SysWOW64\CCM\Logs") Then Folder3 = "C:\Windows\SysWOW64\CCM\Logs" set FolderPath3 =objFSO.getFolder(Folder3) Else Folder3 = "X:\Windows\SysWOW64\CCM\Logs" Set FoldPath3 = objFSO.getFolder(Folder3) End If set objFSO = CreateObject("Scripting.FileSystemObject") objFSO.OpenTextFile(MyTarget, 2, True).Write "PK" & Chr(5) & Chr(6) _ & String(18, Chr(0)) Set ShellApp = CreateObject("Shell.Application") Set zip = ShellApp.NameSpace(MyTarget) 'checks if files are there before trying to copy 'otherwise it will error out If folder1 = True And FoldPath1.files.Count >= 1 Then zip.CopyHere Folder1 End If WScript.Sleep 3000 If folder2 = true And FoldPath2.files.Count >= 1 Then zip.CopyHere Folder2 End If WScript.Sleep 3000 If folder3 = true And FoldPath3.files.Count >= 1 Then zip.CopyHere Folder3 End If WScript.Sleep 5000 set ShellApp = Nothing set ZipFile = Nothing Set Folder1 = Nothing Set Folder2 = Nothing Set Folder3 = Nothing createobject("wscript.shell").popup "Zip File Created Successfully", 3

    Read the article

  • Aplicações do SharePoint e Windows Azure

    - by Leniel Macaferi
    Segunda-feira passada eu tive a oportunidade de me apresentar dando uma palestra na SharePoint Conference (em Inglês). Meu segmento na palestra cobriu o novo modelo de Aplicações para Nuvem do SharePoint (SharePoint Cloud App Model) que estamos introduzindo como parte dos próximos lançamentos do SharePoint 2013 e Office 365. Este novo modelo de aplicações para o SharePoint é aditivo para as soluções de total confiança que os desenvolvedores escrevem atualmente, e é construído em torno de três pilares principais: Simplificar o modelo de desenvolvimento tornando-o consistente entre a versão local do SharePoint e a versão online do SharePoint fornecida com o Office 365. Tornar o modelo de execução flexível - permitindo que os desenvolvedores criem aplicações e escrevam código que pode ser executado fora do núcleo do serviço do SharePoint. Isto torna mais fácil implantar aplicações SharePoint usando a Windows Azure, evitando a preocupação com a quebra do SharePoint e das aplicações que rodam dentro dele quando algo é atualizado. Este novo modelo flexível também permite que os desenvolvedores escrevam aplicações do SharePoint que podem alavancar as capacidades do .NET Framework - incluindo ASP.NET Web Forms 4.5, ASP.NET MVC 4, ASP.NET Web API, Entity Framework 5, Async, e mais. Implementar este modelo flexível utilizando protocolos padrão da web - como OAuth, JSON e APIs REST - que permitem aos desenvolvedores reutilizar habilidades e ferramentas, facilmente integrando o SharePoint com arquiteturas Web e arquiteturas para aplicações móveis. Um vídeo da minha palestra + demos está disponível para assistir on-line (em Inglês): Na palestra eu mostrei como construir uma aplicação a partir do zero - ela mostrou como é fácil construir soluções usando a nova aplicação SharePoint, e destacou um cenário web + workflow + móvel que integra o SharePoint com código hospedado na Windows Azure (totalmente construído usando o Visual Studio 2012 e ASP.NET 4.5 - incluindo MVC e Web API). O novo Modelo de Aplicações para Nuvem do SharePoint é algo que eu acho extremamente emocionante, e que vai tornar muito mais fácil criar aplicações SharePoint usando todo o poder da Windows Azure e do .NET Framework. Usar a Windows Azure para estender facilmente soluções baseadas em SaaS como o Office 365 é também algo muito natural e que vai oferecer um monte de ótimas oportunidades para os desenvolvedores.  Espero que ajude, - Scott P.S. Além do blog, eu também estou utilizando o Twitter para atualizações rápidas e para compartilhar links. Siga-me em: twitter.com/ScottGu Texto traduzido do post original por Leniel Macaferi.

    Read the article

  • Oracle Forms Migration Forum - 1/Mar/11 - Lisboa

    - by Claudia Costa
      Modernize o seu Investimento em FormsO Oracle Forms é uma tecnologia de longa data da Oracle que permite desenhar e desenvolver aplicações empresariais de forma rápida e eficiente. Em complemento, o Oracle Reports permite um acesso rápido a toda a informação relevante para o negócio.Como membros da família de produtos Oracle Fusion Middleware, o Oracle Forms e o Oracle Reports garantem grande agilidade, melhor tomada de decisões, mitigação de risco e redução de custos para diversos ambientes de TI.Preserve o seu investimento em FormsO compromisso contínuo da Oracle para com a tecnologia Forms vai permitir-lhe actualizar e reintegrar o investimento já existente. Não só as suas aplicações podem ser implantadas para a Web, como poderão também fazer parte de uma Arquitectura Orientada a Serviços (SOA) construída a partir de Web Services.Nesta sessão de meio dia ficará a conhecer todas as opções de migração de Forms para uma tomada de decisão esclarecida.Iremos abordar os seguintes temas: Modernizar o seu investimento. Tire proveito das mais recentes tecnologias. Escolher o caminho acertado para o seu negócio. Evolução no sentido certo. Preservar activos já existentes. Actualize sem perder o que já investiu. Eleve e modernize o legado Forms na sua organização!Clique aqui para se registar neste evento GRATUITO. Para esclarecimentos adicionais envie-nos um email.   AGENDA Registe-se Agora!

    Read the article

  • Customer Service Experience, Oracle e Cels insieme per innovare le strategie.

    - by Claudia Caramelli-Oracle
    Si è svolto oggi il workshop Oracle "Customer Service Experience. Strategie per progettare un Servizio eccellente e profittevole." che ha visto il contributo del gruppo di ricerca CELS (Research Group on Industrial Engineering, Logistics and Service Operations) e della sezione ASAP SMF dell’Università degli Studi di Bergamo. Giuditta Pezzotta (PhD - Cels) e Roberto Pinto (PhD - Cels) ci hanno presentato la Service Engineering Methodology (SEEM), innovativa piattaforma metodologica che permette di ottimizzare la creazione di valore sia per il cliente finale sia per l’azienda, partendo dalla progettazione del prodotto e arrivando alla progettazione della soluzione prodotto-servizio, e valutando la bontà del prodotto-servizio ipotizzato attraverso strumenti concettuali e di simulazione dei processi. Armando Janigro, CX Strategy Director EMEA - Oracle ha invece parlato di Modern Customer Service, ovvero di come adattarsi in modo agile e veloce alle mutevoli necessità dei clienti, ipotizzando l’adozione in chiave strategica di nuovi strumenti di differenziazione e di leadership come la Customer Experience (CX) e sfruttando le nuove dinamiche di relazione azienda-singolo consumatore per ottimizzare l’esperienza multicanale e per render più efficiente il Customer Service, creando ulteriore valore. A seguire è stata mostrata da PierLuigi Coli, Principal Sales Consultant - Oracle, una demo sui prodotti Service Cloud offerti da Oracle, a supporto di tutti i concetti raccontati nelle sessioni precedenti. Il workshop è stato un’occasione unica per definire i percorsi da intraprendere per sviluppare efficaci strategie di Customer Experience grazie ad approcci e metodologie innovative alla base di uno sviluppo sostenibile del business. Le slide proiettate sono disponibili su richiesta: scrivi a Claudia Caramelli per ogni informazione o chiarimento.

    Read the article

  • Working with Silverlight DataGrid RowDetailsTemplate

    - by mohanbrij
    In this post I am going to show how we can use the Silverlight DataGrid RowDetails Template, Before I start I assume that you know basics of Silverlight and also know how you create a Silverlight Projects. I have started with the Silverlight Application, and kept all the default options before I created a Silverlight Project. After this I added a Silverlight DataGrid control to my MainForm.xaml page, using the DragDrop feature of Visual Studio IDE, this will help me to add the default namespace and references automatically. Just to give you a quick look of what exactly I am going to do, I will show you in the screen below my final target, before I start explaining rest of my codes. Before I start with the real code, first I have to do some ground work, as I am not getting the data from the DB, so I am creating a class where I will populate the dummy data. EmployeeData.cs public class EmployeeData { public string FirstName { get; set; } public string LastName { get; set; } public string Address { get; set; } public string City { get; set; } public string State { get; set; } public string Country { get; set; } public EmployeeData() { } public List<EmployeeData> GetEmployeeData() { List<EmployeeData> employees = new List<EmployeeData>(); employees.Add ( new EmployeeData { Address = "#407, PH1, Foyer Appartment", City = "Bangalore", Country = "India", FirstName = "Brij", LastName = "Mohan", State = "Karnataka" }); employees.Add ( new EmployeeData { Address = "#332, Dayal Niketan", City = "Jamshedpur", Country = "India", FirstName = "Arun", LastName = "Dayal", State = "Jharkhand" }); employees.Add ( new EmployeeData { Address = "#77, MSR Nagar", City = "Bangalore", Country = "India", FirstName = "Sunita", LastName = "Mohan", State = "Karnataka" }); return employees; } } The above class will give me some sample data, I think this will be good enough to start with the actual code. now I am giving below the XAML code from my MainForm.xaml First I will put the Silverlight DataGrid, <data:DataGrid x:Name="gridEmployee" CanUserReorderColumns="False" CanUserSortColumns="False" RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Center" ScrollViewer.VerticalScrollBarVisibility="Auto" Height="200" AutoGenerateColumns="False" Width="350" VerticalAlignment="Center"> Here, the most important property which I am going to set is RowDetailsVisibilityMode="VisibleWhenSelected" This will display the RowDetails only when we select the desired Row. Other option we have in this is Collapsed and Visible. Which will either make the row details always Visible or Always Collapsed. but to get the real effect I have selected VisibleWhenSelected. Now I am going to put the rest of my XAML code. <data:DataGrid.Columns> <!--Begin FirstName Column--> <data:DataGridTextColumn Width="150" Header="First Name" Binding="{Binding FirstName}"/> <!--End FirstName Column--> <!--Begin LastName Column--> <data:DataGridTextColumn Width="150" Header="Last Name" Binding="{Binding LastName}"/> <!--End LastName Column--> </data:DataGrid.Columns> <data:DataGrid.RowDetailsTemplate> <!-- Begin row details section. --> <DataTemplate> <Border BorderBrush="Black" BorderThickness="1" Background="White"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="0.2*" /> <ColumnDefinition Width="0.8*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <!-- Controls are bound to FullAddress properties. --> <TextBlock Text="Address : " Grid.Column="0" Grid.Row="0" /> <TextBlock Text="{Binding Address}" Grid.Column="1" Grid.Row="0" /> <TextBlock Text="City : " Grid.Column="0" Grid.Row="1" /> <TextBlock Text="{Binding City}" Grid.Column="1" Grid.Row="1" /> <TextBlock Text="State : " Grid.Column="0" Grid.Row="2" /> <TextBlock Text="{Binding State}" Grid.Column="1" Grid.Row="2" /> <TextBlock Text="Country : " Grid.Column="0" Grid.Row="3" /> <TextBlock Text="{Binding Country}" Grid.Column="1" Grid.Row="3" /> </Grid> </Border> </DataTemplate> <!-- End row details section. --> </data:DataGrid.RowDetailsTemplate>   In the code above, first I am declaring the simple dataGridTextColumn for FirstName and LastName, and after this I am creating the RowDetailTemplate, where we are just putting the code what we usually do to design the Grid. I mean nothing very much RowDetailTemplate Specific, most of the code which you will see inside the RowDetailsTemplate is plain and simple, where I am binding rest of the Address Column. And that,s it. Once we will bind the DataGrid, you are ready to go. In the code below from MainForm.xaml.cs, I am just binding the DataGrid public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); BindControls(); } private void BindControls() { EmployeeData employees = new EmployeeData(); gridEmployee.ItemsSource = employees.GetEmployeeData(); } } Once you will run, you can see the output I have given in the screenshot above. In this example I have just shown the very basic example, now it up to your creativity and requirement, you can put some other controls like checkbox, Images, even other DataGrid, etc inside this RowDetailsTemplate column. I am attaching my sample source code with this post. I have used Silverlight 3 and Visual Studio 2008, but this is fully compatible with you Silverlight 4 and Visual Studio 2010. you may just need to Upgrade the attached Sample. You can download from here.

    Read the article

  • DonXml does WCF in NYC

    - by gsusx
    Tomorrow is WCF day in New York city!!!!! My good friend and Tellago's CTO Don Demsak will be doing a session WCF Data and RIA Services at the WCF fire-starter event to be hosted at the Microsoft offices in New York city. Don has a encyclopedic knowledge of both technologies and will be sharing lots of best practices learned from applying these technologies in large service oriented environments. In addition to Don, my crazy Cuban friend Miguel Castro will also be presenting three sessions at the...(read more)

    Read the article

  • SQL SERVER – How to Force New Cardinality Estimation or Old Cardinality Estimation

    - by Pinal Dave
    After reading my initial two blog posts on New Cardinality Estimation, I received quite a few questions. Once I receive this question, I felt I should have clarified it earlier few things when I started to write about cardinality. Before continuing this blog, if you have not read it before I suggest you read following two blog posts. SQL SERVER – Simple Demo of New Cardinality Estimation Features of SQL Server 2014 SQL SERVER – Cardinality Estimation and Performance – SQL in Sixty Seconds #072 Q: Does new cardinality will improve performance of all of my queries? A: Remember, there is no 0 or 1 logic when it is about estimation. The general assumption is that most of the queries will be benefited by new cardinality estimation introduced in SQL Server 2014. That is why the generic advice is to set the compatibility level of the database to 120, which is for SQL Server 2014. Q: Is it possible that after changing cardinality estimation to new logic by setting the value to compatibility level to 120, I get degraded performance for few queries? A: Yes, it is possible. However, the number of the queries where this impact should be very less. Q: Can I still run my database in older compatibility level and force few queries to newer cardinality estimation logic? If yes, How? A: Yes, you can do that. You will need to force your query with trace flag 2312 to use newer cardinality estimation logic. USE AdventureWorks2014 GO -- Old Cardinality Estimation ALTER DATABASE AdventureWorks2014 SET COMPATIBILITY_LEVEL = 110 GO -- Using New Cardinality Estimation SELECT [AddressID],[AddressLine1],[City] FROM [Person].[Address] OPTION(QUERYTRACEON 2312);; -- Using Old Cardinality Estimation SELECT [AddressID],[AddressLine1],[City] FROM [Person].[Address]; GO Q: Can I run my database in newer compatibility level and force few queries to older cardinality estimation logic? If yes, How? A: Yes, you can do that. You will need to force your query with trace flag 9481 to use newer cardinality estimation logic. USE AdventureWorks2014 GO -- NEW Cardinality Estimation ALTER DATABASE AdventureWorks2014 SET COMPATIBILITY_LEVEL = 120 GO -- Using New Cardinality Estimation SELECT [AddressID],[AddressLine1],[City] FROM [Person].[Address]; -- Using Old Cardinality Estimation SELECT [AddressID],[AddressLine1],[City] FROM [Person].[Address] OPTION(QUERYTRACEON 9481); GO I guess, I have covered most of the questions so far I have received. If I have missed any questions, please send me again and I will include the same. Reference: Pinal Dave (http://blog.sqlauthority.com)Filed under: PostADay, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, T SQL

    Read the article

  • Before the Summit of 2012

    - by Ajarn Mark Caldwell
    Today, Monday, was the first day of the PASS Summit Preconference training events, but instead I spent the day at the free SQL in the City event put on by Red Gate. For me this was not a financial decision (pre-con sessions cost extra above the general Summit registration) but rather a matter of interest.  I had already included money for pre-cons in this year’s training budget, but none of them really stood out to me, so even if the Red-Gate event were not going on at the same time, I probably would not have gone to any pre-cons this year.  However, the topics being presented at the SQL in the City event were of great interest to me.  There promised to be good information on Continuous Integration and automated deployment of database changes, which lately has been a real hot topic at my work.  And indeed, Red-Gate announced the release of a new tool (still in Early Access Program…a.k.a. Beta) which is called the Deployment Manager.  Since we are in the middle of a TFS implementation project, it will be interesting to see how this plays out and compares to what we put together with the automated builds in TFS.  But, as I understand it, the primary focus of Deployment Manager is not to be the Build process (Red Gate uses JetBrains’ Team City for that in their shop) but rather to aid in the deployment of those build packages, as well as providing easy rollback and a good visualization of which versions of software are in which environments.  It looks promising and I’ve already downloaded the installer package to play with it later. Overall, I was quite impressed with the SQL in the City event.  Having heard many current and past members of the PASS Board of Directors describe the challenges of putting on a large conference, and the growing pains that the PASS Summit has gone through, I am even more impressed that the Red Gate event ran as smoothly as it did.  And it is quite impressive the amount of money that Red Gate must have spent given that this was a no-charge event to attend, they had a very nice hot lunch, and the after-event drinks celebration.  Well done, folks! Of course it was great to hear from a variety of speakers.  Today I listened to some folks from Red Gate like Grant Fritchey (blog | @GFritchey) and David Atkinson (Product Manager for SQL Source Control and now the Deployment Manager tool set); and also Brent Ozar (blog | @BrentO) and Buck Woody (blog | @BuckWoody).  By the way, if you have never seen either Brent or Buck speak, you really should.  Different styles, but both are very entertaining and educational at the same time.  I love Buck’s sense of humor (here’s a tip…don’t be late to Buck’s session or you’ll become part of the presentation) and I praise Brent’s slides.  Brent’s style very much reminds me of that espoused by Garr Reynolds on his Presentation Zen blog (and book) and I am impressed that he can make a technical presentation so engaging. It was a great day, a great way to kick off the week, and I am excited to get into the full Summit!

    Read the article

  • Explore the Earth at Night with Google Maps

    - by Jason Fitzpatrick
    Last week we shared a high-resolution video of the Earth at night. Now we’re back with a mashup that combines that same high-resolution data and Google Maps for an interactive look at a human-illuminated Earth. Hit up the link below to take the Google Maps mashup, titled City Lights 2012, for a spin. City Lights 2012 [Google Maps via Mashable] How to Fix a Stuck Pixel on an LCD Monitor How to Factory Reset Your Android Phone or Tablet When It Won’t Boot Our Geek Trivia App for Windows 8 is Now Available Everywhere

    Read the article

  • How do I do random isometric paths?

    - by user406470
    I'm working on an Isometric city generator, and I am looking for a little push in the right direction. I'm looking to randomly generate roads on a isometric plane. I have never done pathfinding before, and I've googled it and didn't find any articles relating to what I am trying to do. Basically, my program generates a random isometric city and, I am hoping to add roads to that. Any help is appreciated!

    Read the article

  • Sortable & Filterable PrimeFaces DataTable

    - by Geertjan
    <h:form> <p:dataTable value="#{resultManagedBean.customers}" var="customer"> <p:column id="nameHeader" filterBy="#{customer.name}" sortBy="#{customer.name}"> <f:facet name="header"> <h:outputText value="Name" /> </f:facet> <h:outputText value="#{customer.name}" /> </p:column> <p:column id="cityHeader" filterBy="#{customer.city}" sortBy="#{customer.city}"> <f:facet name="header"> <h:outputText value="City" /> </f:facet> <h:outputText value="#{customer.city}" /> </p:column> </p:dataTable> </h:form> That gives me this: And here's the filter in action: Behind this, I have: import com.mycompany.mavenproject3.entities.Customer; import java.io.Serializable; import java.util.List; import javax.annotation.PostConstruct; import javax.ejb.EJB; import javax.faces.bean.RequestScoped; import javax.inject.Named; @Named(value = "resultManagedBean") @RequestScoped public class ResultManagedBean implements Serializable { @EJB private CustomerSessionBean customerSessionBean; public ResultManagedBean() { } private List<Customer> customers; @PostConstruct public void init(){ customers = customerSessionBean.getCustomers(); } public List<Customer> getCustomers() { return customers; } public void setCustomers(List<Customer> customers) { this.customers = customers; } } And the above refers to the EJB below, which is a standard EJB that I create in all my Java EE 6 demos: import com.mycompany.mavenproject3.entities.Customer; import java.io.Serializable; import java.util.List; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; @Stateless public class CustomerSessionBean implements Serializable{ @PersistenceContext EntityManager em; public List getCustomers() { return em.createNamedQuery("Customer.findAll").getResultList(); } } Only problem is that the columns are only sortable after the first time I use the filter.

    Read the article

  • Can my loop be optimized any more? (C++)

    - by Sagekilla
    Below is one of my inner loops that's run several thousand times, with input sizes of 20 - 1000 or more. Is there anything I can do to help squeeze any more performance out of this? I'm not looking to move this code to something like using tree codes (Barnes-Hut), but towards optimizing the actual calculations happening inside, since the same calculations occur in the Barnes-Hut algorithm. Any help is appreciated! typedef double real; struct Particle { Vector pos, vel, acc, jerk; Vector oldPos, oldVel, oldAcc, oldJerk; real mass; }; class Vector { private: real vec[3]; public: // Operators defined here }; real Gravity::interact(Particle *p, size_t numParticles) { PROFILE_FUNC(); real tau_q = 1e300; for (size_t i = 0; i < numParticles; i++) { p[i].jerk = 0; p[i].acc = 0; } for (size_t i = 0; i < numParticles; i++) { for (size_t j = i+1; j < numParticles; j++) { Vector r = p[j].pos - p[i].pos; Vector v = p[j].vel - p[i].vel; real r2 = lengthsq(r); real v2 = lengthsq(v); // Calculate inverse of |r|^3 real r3i = Constants::G * pow(r2, -1.5); // da = r / |r|^3 // dj = (v / |r|^3 - 3 * (r . v) * r / |r|^5 Vector da = r * r3i; Vector dj = (v - r * (3 * dot(r, v) / r2)) * r3i; // Calculate new acceleration and jerk p[i].acc += da * p[j].mass; p[i].jerk += dj * p[j].mass; p[j].acc -= da * p[i].mass; p[j].jerk -= dj * p[i].mass; // Collision estimation // Metric 1) tau = |r|^2 / |a(j) - a(i)| // Metric 2) tau = |r|^4 / |v|^4 real mij = p[i].mass + p[j].mass; real tau_est_q1 = r2 / (lengthsq(da) * mij * mij); real tau_est_q2 = (r2*r2) / (v2*v2); if (tau_est_q1 < tau_q) tau_q = tau_est_q1; if (tau_est_q2 < tau_q) tau_q = tau_est_q2; } } return sqrt(sqrt(tau_q)); }

    Read the article

  • Dynamic Array Java program converted to C#

    - by Sef
    Hello, The folowing program was orignally in java. But i still get 1 error with the program in C#. (the eror is listed in comment in the 2nd block of code). using System; using System.Collections.Generic; using System.Linq; using System.Text; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DynArray { public class DynArrayTester { static void Main(string[] args) { DynArray da = new DynArray(5); for (int i = 1; i <= 7; i++) { da.setData(i, i); //da.put(0, 0); //da.put(6, 6); } Console.WriteLine(da); } }/*DynArrayTester*/ } using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DynArray { public class DynArray { //toestand private int[] data; //gedrag public DynArray(int size) { data = new int[size]; } public int getData(int index) { return data[index - 1]; } private void expand(int size) { int[] tmp = data; data = new int[size]; for (int i = 0; i < tmp.Length; i++) { data[i] = tmp[i]; } }/*expand*/ public void setData(int index, int data) { if (0 < index) { if (index > this.data.length) // ***error, does not contain definition for "lenght" and no exetension method "lenght"*** expand(index); this.data[index - 1] = data; } } public override string ToString() { StringBuilder buf = new StringBuilder(); for (int i = 0; i < data.Length; i++) { buf.Append("[" + i + "]"); buf.Append(data[i]); buf.Append('\n'); } return buf.ToString(); } }/*DynArray*/ }

    Read the article

  • Oracle Embedded - Duração de meio dia - 14/Abr/10

    - by Claudia Costa
    Convidamo-lo a participar num evento que a Oracle irá realizar no próximo dia 14 de Abril, dedicado a soluções para sistemas Embedded.   A Oracle tem sido desde sempre o líder indisputado - em termos de desempenho, fiabilidade e escalabilidade - em sistemas de gestão de base de dados para aplicações críticas de gestão das grandes organizações. Hoje, no entanto, as aplicações críticas são implementadas não apenas nos data centers, mas cada vez mais em dispositivos móveis, nas infraestruturas de rede e em sistemas de aplicação específica. Por isso, o compromisso da Oracle em desenvolver os melhores produtos de gestão de dados alarga-se hoje do data center às aplicações designadas edge e embedded.   A Oracle oferece hoje a gama mais completa do mercado em tecnologias embedded, tanto para ISVs como para fabricantes de dispositivos e equipamentos, proporcionando-lhe a escolha dos produtos de base de dados e middleware embeddable que melhor se ajustem aos seus requisitos técnicos:   ·         Oracle Database 11g ·         Oracle Database Lite 11g ·         Oracle Berkeley DB ·         Oracle TimesTen In-Memory Database ·         Oracle Fusion Middleware 11g ·         Java for Business   Mais informação sobre produtos embedded Oracle aqui.   Segundo a IDC, a Oracle é hoje o líder mundial no mercado das bases de dados embedded com uma quota de mercado de 28,2% em 2008, estando a crescer a um ritmo 40% superior ao seu concorrente mais próximo e 50% superior à media do mercado.   A par com a riqueza da sua oferta tecnológica, a Oracle oferece igualmente modelos de licenciamento e de preços que se ajustam às necessidades de quem usa esses componentes tecnológicos como peças de uma solução final integrada a se vendida aos seus cliente finais.   A Oracle está empenhada em contribuir para o sucesso da sua empresa. Ao pôr os seus interesses acima de tudo, ganha a sua empresa e ganha a Oracle. E, mais importante que tudo, ganham os clientes, que recebem as melhores soluções possíveis.   Em resumo, as soluções embedded da Oracle proporcionam-lhe:   ·         Melhores produtos ·         Clientes mais satisfeitos ·         Maior rentabilidade das suas soluções   Agenda: ·         Oracle and Embedded ·         Embedded Market Trends ·         Oracle portfolio Oracle Database 11g o    Oracle Berkeley DB  o    Oracle Database Lite o    Oracle TimesTen o    Oracle Fusion Middleware ·         Demo: Berkeley DB ·         Embedded Software Licensing (ESL) Models   -----------------------------------------------------------------------------------   Clique aqui e registe-se.   Horário e Local: 9h30 - 13h00 Oracle Lagoas Park - Edf. 8 Porto Salvo   Para mais informações, por favor contacte: Melissa Lopes 214235194  

    Read the article

  • Oracle Embedded - 14 de Abril

    - by Claudia Costa
      Convidamo-lo a participar num evento que a Oracle irá realizar no próximo dia 14 de Abril, dedicado a soluções para sistemas Embedded.   A Oracle tem sido desde sempre o líder indisputado - em termos de desempenho, fiabilidade e escalabilidade - em sistemas de gestão de base de dados para aplicações críticas de gestão das grandes organizações. Hoje, no entanto, as aplicações críticas são implementadas não apenas nos data centers, mas cada vez mais em dispositivos móveis, nas infraestruturas de rede e em sistemas de aplicação específica. Por isso, o compromisso da Oracle em desenvolver os melhores produtos de gestão de dados alarga-se hoje do data center às aplicações designadas edge e embedded.   A Oracle oferece hoje a gama mais completa do mercado em tecnologias embedded, tanto para ISVs como para fabricantes de dispositivos e equipamentos, proporcionando-lhe a escolha dos produtos de base de dados e middleware embeddable que melhor se ajustem aos seus requisitos técnicos:   ·         Oracle Database 11g ·         Oracle Database Lite 11g ·         Oracle Berkeley DB ·         Oracle TimesTen In-Memory Database ·         Oracle Fusion Middleware 11g ·         Java for Business   Mais informação sobre produtos embedded Oracle aqui.   Segundo a IDC, a Oracle é hoje o líder mundial no mercado das bases de dados embedded com uma quota de mercado de 28,2% em 2008, estando a crescer a um ritmo 40% superior ao seu concorrente mais próximo e 50% superior à media do mercado.   A par com a riqueza da sua oferta tecnológica, a Oracle oferece igualmente modelos de licenciamento e de preços que se ajustam às necessidades de quem usa esses componentes tecnológicos como peças de uma solução final integrada a se vendida aos seus cliente finais.   A Oracle está empenhada em contribuir para o sucesso da sua empresa. Ao pôr os seus interesses acima de tudo, ganha a sua empresa e ganha a Oracle. E, mais importante que tudo, ganham os clientes, que recebem as melhores soluções possíveis.   Em resumo, as soluções embedded da Oracle proporcionam-lhe:   ·         Melhores produtos ·         Clientes mais satisfeitos ·         Maior rentabilidade das suas soluções   Agenda: ·         Oracle and Embedded ·         Embedded Market Trends ·         Oracle portfolio Oracle Database 11g o    Oracle Berkeley DB  o    Oracle Database Lite o    Oracle TimesTen o    Oracle Fusion Middleware ·         Demo: Berkeley DB ·         Embedded Software Licensing (ESL) Models   -----------------------------------------------------------------------------------   Clique aqui e registe-se.   Horário e Local: 9h30 - 18h00 Oracle Lagoas Park - Edf. 8 Porto Salvo   Para mais informações, por favor contacte: Melissa Lopes 214235194  

    Read the article

  • error: unable to open database file, SQLiteException was unhandled

    - by rose
    My project has a reference to SQLite.Interop.066.dll and even after putting in the correct path to the SQLite database, the application is still unable to find it. A SQLiteException was unhandled is returned. SQLiteConnection conn = new SQLiteConnection(); //SQLiteDataAdapter da; SQLiteCommandBuilder cb; DataTable dt=new DataTable(); int row = 0; conn.ConnectionString = "Data Source=C:\\database\\info"; conn.Open(); DataRow dr = dt.NewRow(); dr["name"] = txtName.Text; dr["address"] = txtAddress.Text; dr["phone"] = txtPhone.Text; dr["position"] = txtPosition.Text; dt.Rows.Add(dr); da.Update(dt); row = dt.Rows.Count - 1; txtName.Text = dt.Rows[row]["name"].ToString(); txtAddress.Text = dt.Rows[row]["address"].ToString(); txtPhone.Text = dt.Rows[row]["phone"].ToString(); txtPosition.Text = dt.Rows[row]["position"].ToString(); da.Fill(dt); cb = new SQLiteCommandBuilder(da); conn.Dispose(); conn.Close(); The exception occur at line: conn.Open(); sorry for the mistake title error before...

    Read the article

  • How to Convert using of SqlLit to Simple SQL command in C#

    - by Nasser Hajloo
    I want to get start with DayPilot control I do not use SQLLite and this control documented based on SQLLite. I want to use SQL instead of SQL Lite so if you can, please do this for me. main site with samples http://www.daypilot.org/calendar-tutorial.html The database contains a single table with the following structure CREATE TABLE event ( id VARCHAR(50), name VARCHAR(50), eventstart DATETIME, eventend DATETIME); Loading Events private DataTable dbGetEvents(DateTime start, int days) { SQLiteDataAdapter da = new SQLiteDataAdapter("SELECT [id], [name], [eventstart], [eventend] FROM [event] WHERE NOT (([eventend] <= @start) OR ([eventstart] >= @end))", ConfigurationManager.ConnectionStrings["db"].ConnectionString); da.SelectCommand.Parameters.AddWithValue("start", start); da.SelectCommand.Parameters.AddWithValue("end", start.AddDays(days)); DataTable dt = new DataTable(); da.Fill(dt); return dt; } Update private void dbUpdateEvent(string id, DateTime start, DateTime end) { using (SQLiteConnection con = new SQLiteConnection(ConfigurationManager.ConnectionStrings["db"].ConnectionString)) { con.Open(); SQLiteCommand cmd = new SQLiteCommand("UPDATE [event] SET [eventstart] = @start, [eventend] = @end WHERE [id] = @id", con); cmd.Parameters.AddWithValue("id", id); cmd.Parameters.AddWithValue("start", start); cmd.Parameters.AddWithValue("end", end); cmd.ExecuteNonQuery(); } }

    Read the article

  • OleDbExeption Was unhandled in VB.Net

    - by ritch
    Syntax error (missing operator) in query expression '((ProductID = ?) AND ((? = 1 AND Product Name IS NULL) OR (Product Name = ?)) AND ((? = 1 AND Price IS NULL) OR (Price = ?)) AND ((? = 1 AND Quantity IS NULL) OR (Quantity = ?)))'. I need some help sorting this error out in Visual Basics.Net 2008. I am trying to update records in a MS Access Database 2008. I have it being able to update one table but the other table is just not having it. Private Sub Admin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Reads Users into the program from the text file (Located at Module.VB) ReadUsers() 'Connect To Access 2007 Database File con.ConnectionString = ("Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source=E:\Computing\Projects\Login\Login\bds.accdb;") con.Open() 'SQL connect 1 sql = "Select * From Clients" da = New OleDb.OleDbDataAdapter(sql, con) da.Fill(ds, "Clients") MaxRows = ds.Tables("Clients").Rows.Count intCounter = -1 'SQL connect 2 sql2 = "Select * From Products" da2 = New OleDb.OleDbDataAdapter(sql2, con) da2.Fill(ds, "Products") MaxRows2 = ds.Tables("Products").Rows.Count intCounter2 = -1 'Show Clients From Database in a ComboBox ComboBoxClients.DisplayMember = "ClientName" ComboBoxClients.ValueMember = "ClientID" ComboBoxClients.DataSource = ds.Tables("Clients") End Sub The button, the error appears on da2.update(ds, "Products") Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim cb2 As New OleDb.OleDbCommandBuilder(da2) ds.Tables("Products").Rows(intCounter2).Item("Price") = ProductPriceBox.Text da2.Update(ds, "Products") 'Alerts the user that the Database has been updated MsgBox("Database Updated") End Sub However the code works on updating another table Private Sub UpdateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UpdateButton.Click 'Allows users to update records in the Database Dim cb As New OleDb.OleDbCommandBuilder(da) 'Changes the database contents with the content in the text fields ds.Tables("Clients").Rows(intCounter).Item("ClientName") = ClientNameBox.Text ds.Tables("Clients").Rows(intCounter).Item("ClientID") = ClientIDBox.Text ds.Tables("Clients").Rows(intCounter).Item("ClientAddress") = ClientAddressBox.Text ds.Tables("Clients").Rows(intCounter).Item("ClientTelephoneNumber") = ClientNumberBox.Text 'Updates the table withing the Database da.Update(ds, "Clients") 'Alerts the user that the Database has been updated MsgBox("Database Updated") End Sub

    Read the article

  • Add new row in a databound form with a Oracle Sequence as the primary key

    - by Ranhiru
    I am connecting C# with Oracle 11g. I have a DataTable which i fill using an Oracle Data Adapter. OracleDataAdapter da; DataTable dt = new DataTable(); da = new OracleDataAdapter("SELECT * FROM Author", con); da.Fill(dt); I have few text boxes that I have databound to various rows in the data table. txtAuthorID.DataBindings.Add("Text", dt, "AUTHORID"); txtFirstName.DataBindings.Add("Text", dt, "FIRSTNAME"); txtLastName.DataBindings.Add("Text", dt, "LASTNAME"); txtAddress.DataBindings.Add("Text", dt, "ADDRESS"); txtTelephone.DataBindings.Add("Text", dt, "TELEPHONE"); txtEmailAddress.DataBindings.Add("Text", dt, "EMAIL"); I also have a DataGridView below the Text Boxes, showing the contents of the DataTable. dgvAuthor.DataSource = dt; Now when I want to add a new row, i do bm.AddNew(); where bm is defined in Form_Load as BindingManagerBase bm; bm = this.BindingContext[dt]; And when the save button is clicked after all the information is entered and validated, i do this.BindingContext[dt].EndCurrentEdit(); try { da.Update(dt); } catch (Exception ex) { MessageBox.Show(ex.Message); } However the problem comes where when I usually enter a row to the database (using SQL Plus) , I use a my_pk_sequence.nextval for the primary key. But how do i specify that when i add a new row in this method? I catch this exception ORA-01400: cannot insert NULL into ("SYSMAN".AUTHOR.AUTHORID") which is obvious because nothing was specified for the primary key. How do get around this? Thanx a lot in advance :)

    Read the article

  • Wildcards in T-SQL LIKE vs. ASP.net parameters

    - by Vinzcent
    In my SQL statement I use wildcards. But when I try to select something, it never select something. While when I execute the query in Microsoft SQL Server Management Studio, it works fine. What am I doing wrong? Click handler protected void btnTitelAuteur_Click(object sender, EventArgs e) { cvalTitelAuteur.Enabled = true; cvalTitelAuteur.Validate(); if (Page.IsValid) { objdsSelectedBooks.SelectMethod = "getBooksByTitleAuthor"; objdsSelectedBooks.SelectParameters.Clear(); objdsSelectedBooks.SelectParameters.Add(new Parameter("title", DbType.String)); objdsSelectedBooks.SelectParameters.Add(new Parameter("author", DbType.String)); objdsSelectedBooks.Select(); gvSelectedBooks.DataBind(); pnlZoeken.Visible = false; pnlKiezen.Visible = true; } } In my Data Access Layer public static DataTable getBooksByTitleAuthor(string title, string author) { string sql = "SELECT 'AUTHOR' = tblAuthors.FIRSTNAME + ' ' + tblAuthors.LASTNAME, tblBooks.*, tblGenres.GENRE " + "FROM tblAuthors INNER JOIN tblBooks ON tblAuthors.AUTHOR_ID = tblBooks.AUTHOR_ID INNER JOIN tblGenres ON tblBooks.GENRE_ID = tblGenres.GENRE_ID " +"WHERE (tblBooks.TITLE LIKE '%@title%');"; SqlDataAdapter da = new SqlDataAdapter(sql, GetConnectionString()); da.SelectCommand.Parameters.Add("@title", SqlDbType.Text); da.SelectCommand.Parameters["@title"].Value = title; DataSet ds = new DataSet(); da.Fill(ds, "Books"); return ds.Tables["Books"]; }

    Read the article

  • Windows SQL wildcards and ASP.net parameters

    - by Vinzcent
    Hey In my SQL statement I use wildcards. But when I try to select something, it never select something. While when I execute the querry in Microsoft SQL Studio, it works fine. What am I doing wrong? Click handler protected void btnTitelAuteur_Click(object sender, EventArgs e) { cvalTitelAuteur.Enabled = true; cvalTitelAuteur.Validate(); if (Page.IsValid) { objdsSelectedBooks.SelectMethod = "getBooksByTitleAuthor"; objdsSelectedBooks.SelectParameters.Clear(); objdsSelectedBooks.SelectParameters.Add(new Parameter("title", DbType.String)); objdsSelectedBooks.SelectParameters.Add(new Parameter("author", DbType.String)); objdsSelectedBooks.Select(); gvSelectedBooks.DataBind(); pnlZoeken.Visible = false; pnlKiezen.Visible = true; } } In my Data Acces Layer public static DataTable getBooksByTitleAuthor(string title, string author) { string sql = "SELECT 'AUTHOR' = tblAuthors.FIRSTNAME + ' ' + tblAuthors.LASTNAME, tblBooks.*, tblGenres.GENRE " + "FROM tblAuthors INNER JOIN tblBooks ON tblAuthors.AUTHOR_ID = tblBooks.AUTHOR_ID INNER JOIN tblGenres ON tblBooks.GENRE_ID = tblGenres.GENRE_ID " +"WHERE (tblBooks.TITLE LIKE '%@title%');"; SqlDataAdapter da = new SqlDataAdapter(sql, GetConnectionString()); da.SelectCommand.Parameters.Add("@title", SqlDbType.Text); da.SelectCommand.Parameters["@title"].Value = title; DataSet ds = new DataSet(); da.Fill(ds, "Books"); return ds.Tables["Books"]; } Thanks, Vincent

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >