Database Connectivity & SQL

Split from OP's older, unrelated topic

Page 1 of 1

10 Replies - 735 Views - Last Post: 15 July 2011 - 05:43 AM Rate Topic: -----

#1 HRISHI_K  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 19
  • Joined: 22-February 11

Database Connectivity & SQL

Posted 06 July 2011 - 10:18 AM

hey can someone help me with how to use database connectivity and use various sql queries in c# language....i know how to get the whole table but i need to implement insert and update querries in my project
Is This A Good Question/Topic? 0
  • +

Replies To: Database Connectivity & SQL

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6063
  • View blog
  • Posts: 23,515
  • Joined: 23-August 08

Re: Database Connectivity & SQL

Posted 06 July 2011 - 04:50 PM

As you were told in your previous topic (from which I split this post), go read some tutorials!
Was This Post Helpful? 3
  • +
  • -

#3 SurfingShark  Icon User is offline

  • D.I.C Head

Reputation: 38
  • View blog
  • Posts: 188
  • Joined: 18-April 11

Re: Database Connectivity & SQL

Posted 06 July 2011 - 09:02 PM

Honestly, we could give you a code snippet to handle exactly what you're asking for, but it would defeat the whole purpose. You really need to be able to find this information by searching resources. This is a very common requirement, and there are hundreds of great tutorials out there.
Was This Post Helpful? 2
  • +
  • -

#4 HRISHI_K  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 19
  • Joined: 22-February 11

Re: Database Connectivity & SQL

Posted 07 July 2011 - 07:27 AM

well i did read about it on the internet but wasn't able to get it working......something or the other kept me with a errors which i wasn't able to solve........and sir Jack...thank you for ur advice in my previous post...it helped a lot and i was able to learn the basics of c# very well...

i am using visual studio 2010, programming in c#, using windowsForm as template and Microsoft SQL Server Compact 3.5 (.NET Framework Data Provider for Microsoft SQL Server Compact 3.5) as database Connection.....and i want my user to be able to enter entry in usertable which contains userdetails(name, pass, username etc...)

plz...help...i do not need the code...but a way to do so....plz leave links if possible

and sir surfingShark thankyou foor your reply
Was This Post Helpful? 0
  • +
  • -

#5 Curtis Rutland  Icon User is online

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4488
  • View blog
  • Posts: 7,816
  • Joined: 08-June 10

Re: Database Connectivity & SQL

Posted 07 July 2011 - 07:30 AM

So post code you've tried, and post the error. Help us help you.
Was This Post Helpful? 0
  • +
  • -

#6 HRISHI_K  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 19
  • Joined: 22-February 11

Re: Database Connectivity & SQL

Posted 07 July 2011 - 07:52 AM

this is the code for counting the number of rows in my dataset where MyAppDBDataSet is the datasetused, textBox1and textBox2 catch the username and password resp....it shows error as:

Quote

'WindowsFormsApplication1.MyAppDBDataSet' does not contain a definition for 'Visits'
C:\Users\HRISHI\Documents\Visual Studio 2010\Projects\MyAppStore\WindowsFormsApplication1\Login.cs "


         
   int count = 0;
            string find=null;
	        for (int i=0;i<=count-1;i++)
        	{
	            for(int j=0;j<=7;j++)
            	{
                    if
(MyAppDBDataSet.Visits1.Rows[i].ItemArray[j].ToString().Equals(textBox1.Text))
                	{
                        find += MyAppDBDataSet.Visits1.Rows[i].ItemArray[j].ToString() + "\n";
                    }
	 
                	}
	 
        	}
    	    if (find == null)
    	        MessageBox.Show("No records found");
            else if (textBox1.Text == find)
            {
                MessageBox.Show(" username found");
                int count1 = MyAppDBDataSet.Visits.Count;//saves how many rows in table
                string find1 = null;
                for (int i = 0; i <= count1 - 1; i++)
                {
                    for (int j = 0; j <= 7; j++)
                    {
                        if (MyAppDBDataSet.Visits.Rows[i].ItemArray[j].ToString().Equals(textBox1.Text))
                        {
                            find += MyAppDBDataSet.Visits.Rows[i].ItemArray[j].ToString() + "\n";
                        }

                    }

                }
                if (find == null)
                    MessageBox.Show("Username and Password does not match");
                else if (textBox1.Text == find1)
                {
                   
                    MessageBox.Show(" Username and Password Match");
}
}



Please hlp with this problem 1st

This post has been edited by Curtis Rutland: 07 July 2011 - 08:11 AM
Reason for edit:: formatted for our sanity

Was This Post Helpful? -1
  • +
  • -

#7 Curtis Rutland  Icon User is online

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4488
  • View blog
  • Posts: 7,816
  • Joined: 08-June 10

Re: Database Connectivity & SQL

Posted 07 July 2011 - 08:12 AM

It looks like you're using Visits1 in one place, and Visits in another. The compiler is telling you Visits isn't valid.
Was This Post Helpful? 0
  • +
  • -

#8 HRISHI_K  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 19
  • Joined: 22-February 11

Re: Database Connectivity & SQL

Posted 13 July 2011 - 02:21 AM

its showing the same error for visit as well......(i forgot to post it in the last post)

this showed 3 errors for each
Was This Post Helpful? -2
  • +
  • -

#9 Milto  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 23
  • View blog
  • Posts: 139
  • Joined: 10-February 11

Re: Database Connectivity & SQL

Posted 13 July 2011 - 03:39 PM

Quote

'WindowsFormsApplication1.MyAppDBDataSet' does not contain a definition for 'Visits'


Did you properly reference/name "Visits" and "Visits1".
You could try using a SqlDataReader with the proper connection string and have the reader iterate through "Visits" and "Visits1". Which I am assuming stand for username and password?
Was This Post Helpful? 0
  • +
  • -

#10 EvLSnoopY  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 17
  • View blog
  • Posts: 93
  • Joined: 24-November 09

Re: Database Connectivity & SQL

Posted 13 July 2011 - 04:18 PM

I'm going to go out on a limb here and say that it seems as though you really don't know the c# language. I suggest you crack open a book and get to studying.
Was This Post Helpful? 1
  • +
  • -

#11 HRISHI_K  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 19
  • Joined: 22-February 11

Re: Database Connectivity & SQL

Posted 15 July 2011 - 05:43 AM

that maybe the case...i may have missed some important part of the language....
this was a part of my 1st app....it worked fine except for the login part...so i removed it...and after that it worked fine even the database part
:)
thank you sir for ur suggestion....i m considering it a possible situation...and i'll start studying again

thank you
:flowers:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1