hemantwithu's Profile
Reputation: 5
Worker
- Group:
- Contributors
- Active Posts:
- 30 (0.05 per day)
- Joined:
- 18-October 11
- Profile Views:
- 687
- Last Active:
Sep 28 2012 05:52 AM- Currently:
- Offline
Previous Fields
- Country:
- IN
- OS Preference:
- Windows
- Favorite Browser:
- Chrome
- Favorite Processor:
- Intel
- Favorite Gaming Platform:
- XBox
- Your Car:
- BMW
- Dream Kudos:
- 75
Posts I've Made
-
In Topic: Connecting SQL Server 2005 failed
Posted 24 Sep 2012
Swapnilbarde007, on 24 September 2012 - 05:07 PM, said:I have newly installed SQL Sever Express edition and SQL server management studio on my system. I have created a demo application in vb.net to test the SQL server connection. I have a form and a DataGridView dragged on it. I inserted following code on load event of form.
Imports System.Data Imports System.Data.SqlClient Public Class Form1 Private Sub Form1_load(sender As Object, e As EventArgs) Dim connetionString As String Dim connection As SqlConnection Dim command As SqlCommand Dim adapter As New SqlDataAdapter() Dim ds As New DataSet() Dim sql As String connetionString = "Data Source=SWAPNIL;Initial Catalog=MyTestDb;User ID=sa;Password=" sql = "SELECT * FROM tblTEST" connection = New SqlConnection(connetionString) Try connection.Open() command = New SqlCommand(sql, connection) adapter.SelectCommand = command adapter.Fill(ds) connection.Close() DataGridView1.DataSource=Ds.Tables(0) Catch ex As Exception MessageBox.Show("Can not open connection ! ") End Try End Sub End Class End Namespace
I think you are missing some parameters in the Connection String.Please look at you are missing Password.If you want to get the Correct Connection String try to connect to your database in VS 2010 or 2008 using Server Explorer.After It is Connected Successfully right click on the DB in Server Explorer where you will find the Properties Click on it.You will get the Correct Connection String.
Try this and let me know :-) -
In Topic: Cannot update database with datatable
Posted 6 Aug 2012
For Updating the Row using the SqlDataAdapter the table should have a Primary Key Column.
You need to do like this also
da.FillSchema("TableName",ds); -
In Topic: ASP.NET C# input string was not in a correct format (query string)
Posted 16 Jul 2012
Hi ,
Try to modify your Code as given below
if(!String.IsNullOrEmpty(Request.QueryString["CustomID"])) { //1) int custID = int.Parse(Request.QueryString["CustomID"]); //2) string custID = Request.QueryString["CustomID"]; int intCustID = Convert.ToInt32(custID); RemoveItem(intCustID); //3 int custID = 0; int.TryParse(Request.QueryString["CustomID"], out custID); RemoveItem(custID); //this one only returned the value of 0. } -
In Topic: Web.Config connection to Remote Mysql database
Posted 16 Jul 2012
Hi I think you have defined the Connection String in the Web.Config.If you want to get the Connection String from the web.Config you need to add the NameSpace "System.Configuration".
using(SqlConnection con=new SqlConnection(ConfigurationManager.ConnectionString["TestCon"].ConnectionString)) { //Code }
As given above you need to get the Connection from the web.config. -
In Topic: TreeView population from database
Posted 16 Jul 2012
You can write the logic as given below after getting the two generic list Values from the database.
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { var pages = GetPagesByParent(Page); if (pages.Count() > 0) { var roots = pages.Where(p => p.Parent == null); foreach (var root in roots) { //add the root nodes to the tree var rootNode = new TreeNode(root.Title); tree.Nodes.Add(rootNode); //kick off the recursive population PopulateChildNodes(pages, root, rootNode); } } } } protected void PopulateChildNodes(IEnumerable<Page> pages, Page parent, TreeNode parentNode) { var childPages = pages.Where(p => p.Parent == parent); foreach (var page in pages) { var pageNode = new TreeNode(page.Title); parentNode.Nodes.Add(pageNode); //populate the children of the pageNode PopulateChildNodes(pages, page, pageNode); } }
My Information
- Member Title:
- New D.I.C Head
- Age:
- 24 years old
- Birthday:
- June 4, 1988
- Gender:
-
- Location:
- Hyderabad
- Interests:
- Singing Songs
- Years Programming:
- 3
- Programming Languages:
- C,C++,C#.NET,ASP.NET,SQL SERVER 2005,HTML,CSS,.NET 4.0
Contact Information
- E-mail:
- Click here to e-mail me
- Website URL:
-
http://essencesofdotnet.blogspot.in/
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
hemantwithu has no profile comments yet. Why not say hello?