w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Gridview returning empty even when there is data. I want to use data in the gridview to update another database
Per my comment above you may want to do something like: List<string> _OrderIds = new List<string>(); DataTable table = gvOrderLines.DataSource as DataTable; foreach (GridViewRow gvr in table.Rows) { Label myOrderIDLablel = (Label)gvr.FindControl("lblOrderID"); //find control since it is a template field _OrderIds.Add(myOrderIDLablel.Text); } I hope this get you headed in the right direction.

Categories : C#

how to save gridview templated Item data into DB as well as genarate a word document?
I found the solution from this link using Word = Microsoft.Office.Interop.Word; using System.Reflection; using Microsoft.Office.Interop.Word; protected void btnSubmit_OnClick(object sender, EventArgs e) { try { object oMissing = System.Reflection.Missing.Value; object oEndOfDoc = "\endofdoc"; Word._Application oWord; Word._Document oDoc; oWord = new Word.Application(); oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing); object oRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range; Word.Paragraph oParag; oParag = oDoc.Content.Paragraphs.Add(ref oMissing); oParag.Range.Text = "Return Order"; oParag.Range.Font

Categories : C#

how to connect MS Access database with matlab (transfer data from GUI and save in database )
You need to run SQL queries on the database; you can do this with database.fetch (and a few other friends). The example query from the docs: conn = database('dbtoolboxdemo','',''); setdbprefs('DataReturnFormat','cellarray') results = fetch(conn, 'select productdescription from producttable') % Not in the example in the docs: this syntax, which I prefer, is also supported results = conn.fetch('select productdescription from producttable'); Note that you will also need to know how to write SQL. For that, there are plenty of resources online - you just have to search for them.

Categories : Database

how i can insert data into database from gridview
Try this SqlConnection connStr = new SqlConnection ("Data Source=SERVER;Initial Catalog=HRPR;Persist Security Info=True;User ID=hr;Password=11"); SqlCommand com; protected void Button2_Click(object sender, EventArgs e) { SqlConnection connStr = new SqlConnection("Data Source=SERVER;Initial Catalog=HRPR;Persist Security Info=True;User ID=hr;Password=11"); connStr.Open(); foreach (DataGridViewRow row in dataGridView.SelectedRows) { com = new SqlCommand("INSERT INTO tblExmWrittn(column1,column2....) VALUES( '" + row.Cells[0].Value.ToString(); + "', '" + row.Cells[1].Value.ToString();+ "' , '" + row.Cells[2].Value.ToString();+ "' ,'" + row.Cells[3].Value.ToString();+ "','" + row.Cells[4].Value.ToString();+ "' ,'" + row.Cells[5].Value.ToString();+ "','"

Categories : C#

Counting records from database and inserting data into a GridView
you can do it by simple join query in database . try following query : SELECT A.ID , SUM(CASE WHEN B.ID IS NOT NULL THEN 1 ELSE 0 END) AS TOTALNOOFPEOPLE FROM DEPARTMENT AS A LEFT OUTER JOIN PEOPLE AS B ON A.ID = B.DEPARTMENTID GROUP BY A.ID

Categories : C#

How to edit, update and delete in gridview when data comes from database?
There are lots of tutorials about asp gridview control in the net. You just have to search for it. To get you started, this link should give you the first steps. Additional link. Hope that helps!

Categories : Database

how can communicate two SQL database in LAN to save data in both database
Which database engine are you using? There're several ways to build a distributed/replicated database, I'm sure you'll find out how to do it by reading your engine documentation, but we cannot help here without more info.

Categories : SQL

How to save multiple xml files using SQL Server Database
Try with this script, maybe will be useful: CREATE PROCEDURE saveFile (@file varchar(1000), @txt VARCHAR(8000)) AS BEGIN DECLARE @sys_obj INT DECLARE @rst INT DECLARE @fID INT EXECUTE @rst = sp_OACreate 'Scripting.FileSystemObject', @sys_obj OUT EXECUTE sp_OAMethod @sys_obj, 'FileExists', @rst OUT, @file IF @rst=0 BEGIN EXECUTE sp_OAMethod @sys_obj, 'OpenTextFile', @fID OUT, @file, 8, 1 EXECUTE sp_OAMethod @fID, 'WriteLine', Null, @txt EXECUTE sp_OADestroy @fID EXECUTE sp_OADestroy @sys_obj END END And with this line, could be save to disk a String (for example a XML): EXEC saveFile @file = 'C: est.xml', @txt = '<xml><test>123</test></xml>'

Categories : Sql Server

Save multiple same named fields to database PHP
$cols = $_POST['col']; $EvenementID = mysql_real_escape_string($_POST['evenementid']); foreach($cols as $col) { $Ticketnaam = mysql_real_escape_string($col['ticket']); $Aantal = mysql_real_escape_string($col['aantal']); $Prijs = mysql_real_escape_string($col['prijs']); $sql = "INSERT INTO tbl_Tickets (EvenementID, Ticketnaam, Aantal, Prijs) VALUES('".$EvenementID ."', '{$Ticketnaam}', '{$Aantal}', '{$Prijs}')"; $res = mysql_query($sql);//This will execute count($cols) number of times } You need to move the mysql_query($sql) inside the loop, otherwise it will execute the last iteration of the foreach loop only.

Categories : PHP

Retrieve data from database and store in string and bind all the strings to gridview
You can loop through your DataTable returned from your stored procedure in the database, like this: // Iterate through the columns of the DataTable to set the BoundFields dynamically foreach (DataColumn theDataColumn in theDataTable.Columns) { // Instantiate new BoundField BoundField theBoundField = new BoundField(); // Set the DataField value theBoundField.DataField = theDataColumn.ColumnName; // Set the HeaderText value theBoundField.HeaderText = theDataColumn.ColumnName; // Add BoundField to the GridView GridView1.Columns.Add(theBoundField); }

Categories : Asp Net

How to save multiple values in SQLite Database in Android?
first, you need to get the value of the selected item on your multi select spinner. Try this: ArrayList<String> content = new ArrayList<String>(); for (int j = 0; j < checkSelected.length; j++) { if(checkSelected[j]==true) { String values = BrandListAdapter.mListItems.get(j); content.add(values); } } Toast.makeText(getApplicationContext(), content.toString(), Toast.LENGTH_SHORT).show(); I toast the arraylist content just to check if it really contains the value I select. Then when you see the right value on your toast then you could save it on your database. Hope it helps! charot :D

Categories : Android

Unable to export multiple pages of gridview data to excel
This may help. It reiterates all columns and rows and export to Excel sheet.You need to add Microsoft.Office.Interop.Excel private void button2_Click(object sender, EventArgs e) { // creating Excel Application Microsoft.Office.Interop.Excel._Application app = new Microsoft.Office.Interop.Excel.Application(); // creating new WorkBook within Excel application Microsoft.Office.Interop.Excel._Workbook workbook = app.Workbooks.Add(Type.Missing); // creating new Excelsheet in workbook Microsoft.Office.Interop.Excel._Worksheet worksheet = null; // see the excel sheet behind the program app.Visible = true; // get the reference of first sheet. By default its name is Sheet1. // store its reference to worksheet

Categories : C#

display gridview data in another page or other gridview with row data in editable mode
You need to add RowCommand Event in GridView. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowCommand="GridView1_RowCommand"> <asp:LinkButton ID ="lnkEdit" runat ="server" CommandArgument='<%#Eval("Recordid")%>' CommandName ="cmdEdit" Text ='Edit'></asp:LinkButton> </asp:GridView> Here rocordid is the id of your record. In Page behind you need to write code. protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "cmdEdit") { string Recordid = Convert.ToString(e.CommandArgument.ToString()); Response.Redirect("EditPage.aspx?recordid="+Recordid ); } } On EditPage you can get recordid from the query string and can fetch the record form the datab

Categories : Asp Net

How can I save my form data into the database
The form is in the $form variable. When you first run the controller, you're probably in the GET mode and you construct the $form with a new Familia. On the second call, after doing a POST in the twig, you'll bind the request data (the $petition) to the $form, which is then validated and if everything is ok, you persist the $familia using doctrine entity manager. What you have is the typical controller that is explained quite well in the symfony books: http://symfony.com/doc/current/book/forms.html Carefully read the symfony book http://symfony.com/doc/current/book/index.html I know that is quite a literature to read, but it pays well since is extremely well described.

Categories : PHP

Save jpg data from database to a jpg file
You can use MemoryStream object in C# as below MemoryStream memstmSignature = new MemoryStream(InkToBytes(ds.Tables[1].Rows[0]["SIGNATURE"].ToString(), "image/gif", 0, 0)); Image imaSig = Image.FromStream(memstmSignature); imaSig.RotateFlip(RotateFlipType.Rotate180FlipX); imaSig.Save(Path.Combine(this.temporaryFilePath, this.signatureFileName)); memstmSignature.Close(); Helper functions below private static byte[] InkToBytes(string inkStrokes, string encoderType, float x, float y) { ArrayList strokes = new ArrayList(); // max size for bit map int maxX = 0; int maxY = 0; // intialize the strokes array with text string int strokesCount; if (inkStrokes.Length > 0) { if (inkStrokes.EndsWith(

Categories : Sql Server

Save data instead of adding to database
I'm afraid you'll need to get article again from database, update it and save changes. Entity framework automatically tracks changes to entites so in your repository should be: public void EditArticle(Item article) { var dbArticle = entities.items.FirstOrDefault(x => x.Id == article.Id); dbArticle.item_title = article.item_title; //and so on //this is what you call at the end entities.SaveChanges(); }

Categories : Asp Net

I want to auto cursor when I input text in multiple textbox and save to database
to join all numbers as one using javascript: function UpdateNumber() { var num1 = document.getElementById(num1ClientID); var num2 = document.getElementById(num2ClientID); var num3 = document.getElementById(num3ClientID); var num4 = document.getElementById(num4ClientID); var fullnum = num1.value + num2.value + num3.value + num4.value; ex.value = fullnum; } ex is the label on your page where you display the whole number. You can call UpdateNumber() on the onkeyup event of each of your text boxes. Below is a code example for num1 (call UpdateNumber() for all textboxes). <input id="num1ClientID" type="text" onkeyup="UpdateNumber();" name="num1ClientID"> In your code behind, get the value of ex.

Categories : Asp Net

How to get all the data from form at once and save in database in Django?
Let's imagine you've a Django model form class (you cannot save in DB directly a simple form since there is no corresponding schema, but you can with a model form) class MyForm(forms.ModelForm): field1 = forms.IntegerField(...) ... You rendered it in a template with {{ form.as_p }} Then in the reception view, do the following: def myview(request): if request.method == "POST": form = MyForm(request.POST) if form.is_valid(): form.save() # here you save the form all at once else: ... # here return the "form" to the template, and render it with form.as_p: it will display the validation errors else: ... # here treat the get request. If not get: return an Http 404 response

Categories : Django

How to save edited JTable data to database?
As you are using DefaultTableModel you have to register a listener to that model a TableModelListener listening for changes. How to use TableModelListener Example: myTable.getModel().addTableModelListener(new TableModelListener(){ @Override public void tableChanged(TableModelEvent evt){ //code here } });

Categories : Java

How to save data in database through dynamic controls
If you are creating dynamic controls, you need to make sure you recreate them on a post back. This needs to be done before viewstate and events are wired up. The best place to create the controls is during the Page_Init function, no the Page_Load. Look into ASP.Net Page Life Cycle to see how a page gets build.

Categories : Asp Net

Read Email and save data to database in PHP
If the problem really is only parsing, in this case I would recommend simple regex. However what I do recommend is using named patterns, so you dont confuse the indexes and maby have wrong matches. Here is a quick example: $str = <<<body Name: xyz Zip: 33402 body; if(preg_match('/(?P<name>w+): (?P<zip>d+)/', $str, $matches)) { print_r($matches); // db beeing your database connector, for example pdo $sql = "INSERT INTO mytable (name,zip) VALUES(".$db->quote($matches['name']).",".$db->quote($matches['zip']); echo $sql; } else { //mail does not correspond to pattern! } If your mail gets longer, use preg_match several times. Possibly for each field you want to parse separately. Because writing a huge regex if you have more fields is very

Categories : PHP

Save data in database automatically at particular time
Use a ScheduledExecutorService. Calculate the delay until the save date (using Calendar) and .schedule() your Runnable, which will save the data. You will probably want to use a Executors.newSingleThreadScheduledExecutor(). Side note: please use a prepared statement and not string concatenation to generate your SQL query! The JDK has all it takes to do so, there is no reason not to use it.

Categories : Java

Flask - Save session data in database like using cookies
You should check out Flask-KVSession, which is self-described as a drop-in replacement for Flask‘s signed cookie-based session management. Instead of storing data on the client, only a securely generated ID is stored on the client, while the actual session data resides on the server. Which basically describes traditional server-side sessions. Note that it supports multiple database backends: Flask-KVSession uses the simplekv package for storing session data on a variety of backends. See the Example Use for an example of what to import and how to configure it.

Categories : Database

save data to database with click of button/link
If I understood correctly, you need to add button onClick event handler? If so, here you go (using jquery 1.9+): $(document).ready(function() { //onClick event handler for button with id "btn_save" $(document).on("click","#btn_save",function() { //Your code here }); });

Categories : PHP

How to save and retrieve data from sdcard or database in android?
Have a look at SharedPreferences or if you plan to store more data try a SQLite database. Here is the tutorial to store files in Android.

Categories : Android

save dynamically created controls data in database asp.net mvc
Try this: [HttpPost] public ActionResult Create(List<StudentAdditionalDetail> additionalFields) { ads.AddAdditionalDetails(additionalFields);//calls the insert method return RedirectToAction("Index"); }

Categories : C#

How to Edit & Save ViewModels data back to database
First of all, it's really good that you are using ViewModels but for this particular case, it's probably not necessary, your Create view could look like this: @model MvcApplication1.Models.Doctor //other fields here <div class="editor-label"> @Html.LabelFor(model => model.DoctorAddress.Address) </div> <div class="editor-field"> @Html.EditorFor(model => model.DoctorAddress.Address) @Html.ValidationMessageFor(model => model.DoctorAddress.Address) </div> <div class="editor-label"> @Html.LabelFor(model => model.DoctorCharge.IPDCharge) </div> <div class="editor-field"> @Html.EditorFor(model => model.DoctorCharge.IPDCharge) @Html.ValidationMessageFor(model => mo

Categories : Asp Net Mvc

Save view state data into database Error
When you are saving into the database, you redirect right after each insert. Hence, none of the subsequent inserts are executed. I would move the redirect out of the loop. Maybe you can pass the number of records inserted in the query string as well. protected void Button2_Click(object sender, EventArgs e) { foreach (GridViewRow oItem in GridView1.Rows) { string str1 = oItem.Cells[0].Text; string str2 = oItem.Cells[1].Text; string str3 = oItem.Cells[2].Text; insertData(str1, str2, str3); } Response.Redirect("WebForm1.aspx?stat=insert"); } public void insertData(string str1,string str2,string str3) { SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CIMProRPT01ConnectionString"].Conn

Categories : Asp Net

Retrive Data Fron Txt File And Save It in Database
it's as simple as: $ip = fopen('data.txt', "r"); $line = trim(fgets($ip)); while(!feof($ip)){ // do something with line in $line //.... // reading next line $line = trim(fgets($ip)); }

Categories : PHP

How to save the data to database through dynamically loaded controls
in the database vision you need a table with at least 3 columns, first a VARBINARY column that is called BLOB column to store your file, second a VARCHAR column to store your file extension (e.g .gif, .jpeg) , third a VARCHAR or NVARCHAR column to store your caption. but the point is in your application you need to convert your file into array of bytes then pass it to sql server as varbinary parameter. private Byte[] getDocumentFormatter(string path) { FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); Byte[] bytes = br.ReadBytes((Int32)fs.Length); br.Close(); fs.Close(); return bytes; } but in web environment you can replace path with your

Categories : C#

saving data in cookies to save trips to database
Definitely an interesting approach. With this cookies plugin, if you don't specify the expire, your cookie will only stay for the length of the session. So you can simply do: $.cookie("basket-data", JSON.stringify($("#ArticlesHolder").data())); And it will stay for this session only. Just for the record - session storage is definitely a better choice than cookies.

Categories : Jquery

Xml data Node values need to save into Database table
You can easily extract the information from the <Computer> node and insert it into Asset: (PS: Note: it's a processor - not a "processior" (no i after the two s) ) DECLARE @Input XML SET @Input = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Computer Name="WH7" Processor="Intel(R) Core(TM)2 Duo CPU P9600 @ 2.66GHz" Manufacturer="Dell Inc." Model="Latitude E6500" Domain="WORKGROUP" RAM="3536 MB" ServiceTag="DGQKTJ1"> <BIOS Manufacturer="Dell Inc." Version="Phoenix ROM BIOS PLUS Version 1.10 A19"/> </Computer>' INSERT INTO dbo.Asset(Name, Processor, Manufacturer, Model, Domain, RAM, ServiceTag) SELECT Name = @Input.value('(/Computer/@Name)[1]', 'varchar(50)'), Processor = @Input.value('(/Computer/@Proc

Categories : Xml

How to efficiently save data to a remote server database (python)
Django databases can be remote - there is no requirement they be on the same host at the django server. Just set an appropriate HOST and PORT. See: https://docs.djangoproject.com/en/dev/ref/databases/#id10 Update: Based on your comment, I understand that you want to write python/django code that will run in the browser, and connect to a remote database. There is no practical way of doing this. Have the data sent back to your server, and forward it on from there. Update 2: If you are able to distribute software outside of the browser, you could have a small django deployment on each client computer, which the user connects to through their browser, which could connect directly to the database. Obviously, security considerations apply.

Categories : Python

Python, MySQL, load data from database, change it, save it again?
cur.execute returns the number of rows affected - in your case, just 1 row, which is why it always returns 1. To get the actual value, you need to do cur.fetchone(), which will return a tuple of values - again, in your case, a tuple containing a single int. Just an additional tip, since this is a 'learn Python' exercise: global variables are usually frowned on. You should pass xp explicitly into your gainxp function.

Categories : Python

Save Canvas Image data to mySQL database and retrieve it to edit again
Now only i saw this post i got success for storing and retrieving the canvas images using the following references. You need to convert the canvas to image format and the save i to databse. Create The canvas Store the canvas image into mysql DB

Categories : HTML

"Undefined property" when trying to save javascript form data to mysql database via php
I note you are calling echo $_POST['jason']; at the end of your script which I would expect to cause this error - just a typo in the question? You have it correctly as 'json' earlier. Update Ok - think I see it: Defined pcompensation: <textarea name='pcompensation'/></textarea> Reading it: item.find("input[name=pcompensation]").attr("value",p.compensation); Which should be: item.find("textarea[name=pcompensation]").attr("value",p.compensation); Same for your other textarea custom fields.

Categories : PHP

Is it possible to pull data from HTML5's local storage and save to server database?
Yes it's possible, why wouldn't it be? When you pull data from the local storage, the data works just like any other Javascript variable, there are no restrictions that would stop you sending it to a server other than the lack of Internet connection. how would you go about implementing it? First you'd need to detect the connection status, see this question. So when a user tries to update their status, it checks if the connection is online and if it isn't then save it to local storage. Use the methods in the linked question to detect when the connection comes back up, and at that point pull the data from local storage and send it to the server via ajax, then clear the local storage to prevent duplicate data being sent.

Categories : PHP

Save/Update Data into multiple tables using ASP.NET MVC 4
not tested but this may help [HttpPost] public ActionResult Create(StudentViewModel studentViewModel) { if (!ModelState.IsValid) // added ! so that you can do something if it is valid other than redisplay the Create View with the model { return View(studentViewModel); } Student s = new Student() { Name =studentViewModel.Student.Name, Speciality = studentViewModel.Student.Speciality, DateOfJoinig = studentViewModel.Student.DateOfJoinig, Qualification = studentViewModel.Student.Qualification, Email = studentViewModel.Student.Email }; db.Students.Add(s); db.SaveChanges(); // Post the changes with the student and save changes so you have the correct studentId P

Categories : Asp Net Mvc

How to save data from multiple NSTextFields and NSComboBoxes within an NSArray
I found the solution to my problem. Removing the last NStextField (cDesc) and adding a new textfield allowed the array to function properly. I had added new fields previously, but i never removed the faulty field. All I can say is you make stupid mistakes when you are learning a new language. Thank you to anyone who reads this in the future. I know will be back to this site for advice in the future.

Categories : Objective C

Getting multiple data and them adding them into multiple database entries
This is because you are executing your query outside the while loop. The solution would be to move your mysql_query($sq, $cn) inside the while loop. Also your insert query has VALUE instead of VALUES, please see the insert syntax. while($a1 != $b1){ $b1++; $state = "state".$b1; $name = "name".$b1; $info1 = "info1".$b1; $info2 = "info2".$b1; $sq="INSERT INTO ftable(Country, State, Name, First, Second ) VALUES('$c1', '$_POST[$state]', '$_POST[$name]', '$_POST[$info1]', '$_POST[$info2]')"; echo "</br>Country:$c1</br> State:".$_POST[$state]."</br> Name:".$_POST[$name]."</br> Info1:".$_POST[$info1]."</br> Info2:".$_POS

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.