w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Finalizing a Cursor that has not been deactivated or closed or database not closed error
When you are done with the cursor, you need to call Cursor.close(). Leaving it not closed leads to memory leaks. E.g.: Cursor cursor = null; try { cursor = getContentResolver().query(myUri, MY_PROJECTION, null, null, null); if (cursor != null && cursor.moveToFirst()) { // moar code } } finally { if (cursor != null) { cursor.close(); } }

Categories : Android

How to populate UI from data in a database?
One approach is to use a Content Provider, which provides a consistent point of access to your database. With a ContentProvider, you can take advantage of the Loader framework (also available via the Support Library), CursorLoader, and CursorAdapter to keep your ListView in sync with your database.

Categories : Java

my database path in "Data Source=F:databas1.mdf; How to set database connection in c# website?
A great resource I always keep around is connectionstrings.com. It's really handy for finding these connection strings when you can't find an example. Particularly this page applied to your problem Attach a database file on connect to a local SQL Server Express instance Driver={SQL Native Client};Server=.SQLExpress;AttachDbFilename=F:Database.mdf"; Database=dbname;Trusted_Connection=Yes;

Categories : C#

extracting all data from database but "attempt to re-open an already-closed object"
You have to close your cursor in get_All_Ex_Data(), after your loop. The thing you open and close in onPreExecute and onPostExecute is the db helper. Edit : is your database helper a singleton ? You have an example of a singleton here: Using Singleton design pattern for SQLiteDatabase

Categories : Android

Unable to populate table with data from database
try dis one... @FXML private void SearchButton() { Connection c ; datamem = FXCollections.observableArrayList(); try { c = Dao.getCon(); String SQL =SELECT * FROM `Member`; ResultSet rs = c.createStatement().executeQuery(SQL); if(table.getColumns().isEmpty()) { for(int i=0 ; i<rs.getMetaData().getColumnCount(); i++) { final int j = i; TableColumn col = new TableColumn(rs.getMetaData().getColumnName(i+1)); col.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<ObservableList,String>,ObservableValue<String>>(){ public ObservableValu

Categories : Mysql

How to populate mysql database by tweaking existing data
When inserting a SELECTed dataset, you do not use the VALUES keyword. Your statement should be: INSERT INTO `products`(`id`, `Code`, `Product_name`, `Pack`, `MRP`, `VPTR`) SELECT CONCAT(`id`,'1') , `Code`, `Product_name`, `Pack`, `MRP`, `VPTR` FROM `products`

Categories : Mysql

populate listview dialog with data from sqlite database
You need to create a class extending CursorAdapter http://developer.android.com/reference/android/widget/CursorAdapter.html and provide instance of this class to the AlertDialog.Builder setAdapter method. builder.setAdapter(adapter, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { //handle item selection } } });

Categories : Android

Any way to populate database by multiplying existing data in Rails?
You can use .dup for this: posts = Post.all.to_a 9.times do posts.each do |post| post.dup.save end end .to_a will make sure all the records are fetched immediately, so adding new records won't cause any problems.

Categories : Ruby On Rails

How to populate data from SQL Server database columns to textboxes
SqlCommand cmd = new System.Data.SqlClient.SqlCommand(sql, _conn); SqlDataReader rdr = cmd.ExecuteReader(); System.Data.DataTable tbl = new System.Data.DataTable("Results"); tbl.Load(rdr); if (tbl.Rows.Count > 0) Name.Text = tbl.Rows[0]["column_name"].ToString();

Categories : C#

initially populate data in rails if database is empty from application
As you eluded to, this is not the best idea in the world, but maybe you could try using on of these approaches: An initializer that will get called each time the rails environment is loaded. Something in the config.after_initialize block. See http://guides.rubyonrails.org/configuring.html

Categories : Ruby On Rails

CodeIgniter: Populate an input text in the view from data array grabbed from database
Try something on the lines of: Controller: function get_customer_details() { $guest_name = $this->input->post('guest_name'); $data = $this->banquet_model->talk_to_new_guest_table($guest_name); if ($data != 0) { $this->load->view('/main/banquet_view', $data); } } Model: function talk_to_new_guest_table($guest_name) { $query = $this->db->query(" SELECT guest_name, guest_gender, guest_nic_pp_dl FROM new_guest WHERE guest_name LIKE '$guest_name%' LIMIT 1 "); if($query->num_rows()>0) { return $query->result(); } else { return 0; } } View: <div class="control-group"> <label for="guest_name

Categories : PHP

Receive and store data on website database
On load of the page use something loke this. public class ajax : IHttpHandler, IRequiresSessionState { public void ProcessRequest(HttpContext context) { Stream dataStream = context.Request.InputStream; StreamReader reader = new StreamReader(dataStream); string responseFromServer = reader.ReadToEnd(); JavaScriptSerializer json_serializer = new JavaScriptSerializer(); Dictionary<string, object> data = (Dictionary<string, object>)json_serializer.DeserializeObject(responseFromServer); selected_user u = new selected_user(); u.user_name = data["uname"].ToString(); u.pass = data["pass"].ToString(); u.sname = data["lname"].ToString(); context.Response.Write(yourjsonre

Categories : C#

Get data from phpMyAdmin database from bluehost hosted website
bluehost has a remote database section in the cpanel, You can add whatever IP address you need to access that database and use a remote mysql connection. If your ip address will change you can add a class C range, otherwise you may need a different database hosting provider that allows for wildcard ip addresses to connect.

Categories : Mysql

How to crawl a website/extract data into database C# and SQLSERVER
The road you're heading down if fraught with problems. I'd never attempt it. Consider these challenges: You'd have to parse the HTML which may or may not be well formed The data may be interspersed with all kinds of non-data (ads, navigation, hover text, javascript, comments, etc.) You have no idea of the age of the data The format of HTML for a given site may change from one day to the next and possibly break your previous scraping strategies Important information may exist on pages only accessed after satisfying an authorization step Data that used to live at one URL may have been moved around and is now living at a different URL or split up into several different URL's Some data may only be found if certain search parameters are entered or if certain users are logged in Users of yo

Categories : C#

Uploading Excel sheet data into SQL database via a website
First, your Excel file has to be in CSV format, otherwise it will be a lot more difficult to insert data in your database (you have to parse it with PhpExcel for example). If your Excel file is CSV, then you have to use LOAD DATA INFILE. You can see an example here : http://stackoverflow.com/a/10897669/1788704

Categories : PHP

Website form populated from mySQL database, how to return data
Submit the first form (without the two field), INSERT the data into the database, get the ID of insert. Pass the ID to the next page which would set the ID into a hidden form field (or GET or POST parameter, plenty of choices) of the new form (with the two fields and just UPDATE the database upon submitting the second form. If you like to show the original data in the second form, just pull the data from the database and use it to render the form instead of passing just the ID into a hidden field.

Categories : PHP

Searching data from database using checkbox list for a ecommerce website
You need to iterate through your checkboxlist and test the selected value for each item and build a string containing each of your options. string queryparam = ''; for (int i=0; i<checkboxlist1.Items.Count; i++) { if (checkboxlist1.Items[i].Selected) { queryparam += (queryparam.Length = 0) ? "id = " + checkboxlist1.Items[i].Text : " or id = " checkboxlist1.Items[i].Text } } This should give you an idea to start with.

Categories : C#

Data in MySQL database doesn't show correctly in website
Assuming you've correctly converted the data in your tables to UTF-8 (just changing the character set is not enough), it sounds like you might be having problems with the connection not being set up as UTF-8. Have a look at SET NAMES, and more specifically this question. If you're not sure you've converted your data to UTF-8, I'd have a look at this question as well as this Wordpress article and make sure you've followed the steps.

Categories : PHP

Unable to connect database using ADO.NET entity data model when website is hosted in IIS
When you are execution your program on your local computer, you use your User to connect to your database. When you publish on your Webserver with IIS (I'm assuming you are using IIS 7.0), the default user will be "IUSR". With this information, you need to verify if the IIS user as access to the database in the security setting of the server.

Categories : C#

transfer form data form user to database server of my website in php
You'll have to change the credentials in mysqli_connect('localhost','root','root'); and select a database (eg. mysqli_select_db($link, "test");, where "test" is your database name). I suggest you to put your database connection function in a separated file. You'll probably have to connect to your database in more than just a page, so you won't have to call mysqli_connect again. This way, if you change your credentials, you won't have to change it in all your files. For example : <?php // dbconnect.php function dbconnect() { $dbhost = "localhost"; $dbname = "test"; $dbuser = "username"; $dbpass = "password"; $cn = mysqli_connect($dbhost, $dbuser, $dbpass) or die('Connection error !'); mysqli_select_db($cn, $dbname) or die('Error while selecting database'); retur

Categories : Mysql

Is there a more efficient way of ensuring my database gets closed?
Use a block: def use_db(database_name) db = Daybreak::DB.new(database_name) yield db ensure db.close end use_db($ShowDatabaseName) do |db| # do something with db end

Categories : Ruby

Can I secure my website forms via database (inserting token in a database rather than putting it in a session)
I belive that inserting a token and the IP address of the client into a database table and simultaneously adding the token to an input field in the form would be safer than inserting the token into a session variable that can be hijacked. a. Server-side, database storage vs session variable storage: there is no difference; indeed many session implementations are based on database storage. Session variables cannot be ‘hijacked’ (unless there is something seriously and uncommonly broken about the session implementation). b. Client-side, form parameter passing vs cookie passing: the form parameter scheme is considerably worse. Some session frameworks used to allow session IDs to be passed in as form parameters instead of cookies, which is essentially what you are doing. But this all

Categories : Forms

Is there a way to know when all connections/transactions on a database are closed in IndexedDB?
call close on a database connection prior to upgrading You don't call close in this case. Call close if you no longer use the connection or the connection is no longer usable.

Categories : HTML

OpenEntityManagerInViewFilter closed session before database update
I know what happen. I have multiple *-config.xml all of them have <context:annotation-config /> <context:component-scan base-package="cn.hballSoft.domain" /> <context:component-scan base-package="cn.hballSoft.security.domain" /> maybe it cause duplicate load transaction config. keep single and slove the problem.

Categories : Spring

Keep communication with database mysql when the browser closed by user
I would do exactly what @Joachim suggested and follow this flow: Replace residual_time with start_time with type being datetime. Add last_update with type being datetime. When the user clicks start set the start_time and last_update with the NOW() MySQL function Write a function and run it with AJAX every 30? second to check if last_update is 60 minutes past start_time and if so to stop the questionnaire and clear both start_time and last_update. Now let's assume a user quits and logs out mid time alloted and then logs back in to continue: //sudo code example //check if start_time is set if(isset(start_time)){ //check if last_update time is set if(isset(last_update)){ //calculate the time difference in minutes from previous start_time and last_update time time_

Categories : Mysql

Ruby: get the website data after logging into website
There are plenty of examples here mechanize example If you are looking at http authentication then a similar post is here basic-and-form-authentication-with-mechanize-ruby Use mechanize to make life easier.

Categories : Ruby On Rails

website to pull data from another website and return it
This is a really expansive answer, to do this, you have to have a piece of software to read in an API from a live score site and display it. It cant be answered in one answer, to know more about APIs take this course. Hope that helps you, check the course syllabus (on the same page), there is a unit called How to Connect which will help you. Leave a comment to tell me if it helps or if i can do anything else to make it more helpful...

Categories : C#

Local database in Appjs doesnot persist after the application is closed
what kind of database are you using? Nodejs can connect to many different types of database like sqlite, mysql, postgres and mongodb. In app.js you can use the constant: __dirname to get the path of the currently executing script so if you are using sqlite3 or simliar then you can put the database into the local directory. If you are trying to use indexedBD or simliar then I just searched on the issues on github. Milani has the following solution in app.js, you should set a directory to use to persist the data: var app = require('appjs'); var path = require('path'); app.init({ "CachePath":path.resolve(__dirname,"./data") // change to whatever path you like }); Then in the browser / index.html: window.localStorage.setItem('test5','test5 content'); var test = window.localStorage.ge

Categories : HTML

How to populate a ListView from my database using sqlite
Use a CustomAdapter public class Display extends Activity implements OnItemClickListener{ DatabaseManager db; List<PlayerData> contacts; ArrayList<String> con= new ArrayList<String>(); LayoutInflater mInflater; CheckBox cb; TextView tv1; CustomAdapter cus; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.listview); ListView lv= (ListView) findViewById(R.id.lv); db = new DatabaseManager(this); contacts = db.getAllContacts(); cus = new CustomAdapter(); lv.setAdapter(cus); lv.setOnItemClickListener(this); lv.setItemsCanFocus(false);

Categories : Android

In struts1.2 how to populate dropdown according to database value
The dropdown list should be represented by a list of LabelValueBean objects in your form class as follows. List<LabelValueBean> listOfStandards = new ArrayList<LabelValueBean>(); //popoulate the list myForm.setStandardList(listOfStandards); And in your jsp you can access the list in your drop down list as follows: <html:select property="standard" styleId="standard"> <html:optionsCollection name="myForm" property="standardList" label="label" value="value" /> </html:select> Note: Make sure you have a "standard" property in your form. The "standard" property will be set with the value of the selected item from the dropdown list.

Categories : Jsp

Populate ListView with SQL database ERROR
The problem is here: map.put(KEY_HOLE, c.getString(1)); // correct map.put(KEY_PAR, getString(2)); // incorrect! map.put(KEY_HANDICAP, getString(3)); // incorrect! map.put(KEY_YARDS,getString(4)); // incorrect! You have getString() instead of c.getString() for the last three.

Categories : Java

Populate dropdown box won't show up database
Your code makes no sense. You run the query if a particular form field is present, but only run the "display results" code when that same form field is NOT present. Easiest fix: REMOVE the } else {...

Categories : PHP

How to populate a large sqlite database on first run
Create entire content into csv file possibly multiple csv files and compress into zip. I have checked with 32 mb csv file after compression the file become 482KB. For Example data1.csv data2.csv data3.csv data4.csv data5.csv compress the files into data.zip and put file into asset folder, when importing - extract file from the zip one by one and insert into sqlite db.

Categories : Java

populate list with images from database
Your code has several flaws - you need to use something like this instead: // define connection string and select statement // I used AdventureWorks 2012 database - change to match *YOUR* environment string connectionString = "server=.;database=AdventureWorks2012;integrated security=SSPI;"; string query = "SELECT ThumbNailPhoto FROM Production.ProductPhoto"; // define a list of "Image" objects List<Image> listOfImages = new List<Image>(); // using the SqlConnection and SqlCommand .... using(SqlConnection conn = new SqlConnection(connectionString)) using (SqlCommand selectCmd = new SqlCommand(query, conn)) { // open connection conn.Open(); // execute SqlCommand to return a SqlDataReader using (SqlDataReader rdr = selectCmd.ExecuteReader()) {

Categories : C#

Pre-populate checkboxlist from values in database
Loop through the cblsthobbies.Items collection and set the Selected property value of each item like this foreach (var i in cblsthobbies.Items) { i.Selected = i.SelectedValue == dr["HobbyId"].ToString(); }

Categories : C#

Populate a tableview using database in JavaFX
I'm sure this will help you: public class DBClass{ public Connection getConnection() throws ClassNotFoundException, SQLException{ Class.forName("com.mysql.jdbc.Driver"); return DriverManager.getConnection("jdbc:mysql://192.168.0.1:3306/dbname","mysqluser","mysqluserpwd"); } } In Controller Class do the following : @FXML void initialize(){ assert tableview != null : "fx:id="tableview" was not injected: check your FXML file 'UserMaster.fxml'."; colUserName.setCellValueFactory( new PropertyValueFactory<Usermaster,String>("userName")); colPassword.setCellValueFactory( new PropertyValueFactory<Usermaster,String>("userPassword")); colUserType.setCellValueFactory( new Prop

Categories : Java

Populate treeview from database (two classes)
The simplest way is to use some kind of tree-structure as a return value for GetSports() instead of "List" and fill this structure with leagues or something else with more complicated sql-query. Then just fill treeview using data from this structure.

Categories : C#

Fastest way to update (populate) 1,000,000 records into a database using .NET
Have you tried SSIS? I have never written an SSIS package with a loacldb connection, but this is the sort of activity SSIS should be well suited. If your data source is a SQL Server, another idea would be setting up a linked server. Not sure if this would work with localdb. If you can set up a linked server, you could bypass the C# all together and load your data with an INSERT .. SELECT ... FROM ... SQL statement.

Categories : C#

Jenkins: How can I populate parameters from database to parameterized job?
We have to use Jenkins Dynamic Parameter Plug-in to pull values from database and show parameters as dropdown in Jenkins parameterized job. LINK: https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Dynamic+Parameter+Plug-in We have to write groovy script to pull values from database and click on above link for more details.

Categories : Jenkins

How To Populate A Treeview With All Columns And Values From SQL Database
I don't think you can do that with one query. Some pseudo code... 'get empty recordset, just to get all the field names query = "SELECT * FROM mytable WHERE 1=2" rs = conn.open(query) 'loop over the fields and add them to the treeview while storing a reference 'of the created node in variable n foreach f in rs.fields set n = treeview.addnode(f.name) 'for the created node get the unique values occuring in that column query = "SELECT DISTINCT " & f.name & " FROM mytable ORDER BY " & f.name rs2 = conn.open(query) 'loop over the found values while not rs2.EOF 'add each value to the treeview as a child of node n treeview.addnode(rs2.fields(f.name), n) rs2.MoveNext loop next f

Categories : Mysql



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