⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

connecting to sql server database



Mohammed Zayan

Mohammed Zayan
  • profile picture
  • Member

Posted 27 January 2013 - 07:23 AM

Hi there,
I connect to sql server database by codeigniter and I can make sql queries normally.
when I want to use grocerycrud

function test_gro(){
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('Employee');
$crud->set_subject('موظف');
$crud->unset_export();
$crud->unset_print();
$output = $crud->render();
$this->_example_output($output);
}


I have this error
[quote]
[b] A Database Error Occurred[/b]
[color=#4F5155][font='normal Helvetica', Arial, sans-serif][size=3]
Error Number: 42000[/size][/font][/color][color=#4F5155][font='normal Helvetica', Arial, sans-serif][size=3]
[Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near the keyword 'FROM'.[/size][/font][/color][color=#4F5155][font='normal Helvetica', Arial, sans-serif][size=3]
SHOW COLUMNS FROM `Employee`[/size][/font][/color][color=#4F5155][font='normal Helvetica', Arial, sans-serif][size=3]
Filename: D:\xampp\htdocs\test\system\database\DB_driver.php[/size][/font][/color]
[color=#4F5155][font='normal Helvetica', Arial, sans-serif][size=3]Line Number: 330[/size][/font][/color][/quote]

ELJUSTICEIRO

ELJUSTICEIRO
  • profile picture
  • Member

Posted 23 May 2013 - 12:41 PM

I'm having the same problem, did you get any solution?

 


Mohammed Zayan

Mohammed Zayan
  • profile picture
  • Member

Posted 23 May 2013 - 12:49 PM

No,

I don't use grocerycrud in this site

and make every thing by codeIgniter only


davidoster

davidoster
  • profile picture
  • Member

Posted 24 May 2013 - 05:55 AM

Grocery CRUD currently supports only MySQL databases.


ELJUSTICEIRO

ELJUSTICEIRO
  • profile picture
  • Member

Posted 05 July 2013 - 19:18 PM

I'm starting to migrate to Sql Server ... if anyone can give me some pointers?
Follows what has already shifted

 

        $query = "
SELECT     syscolumns.name AS Field, systypes.name +  '('+ CAST(syscolumns.LENGTH as varchar) + ')'  as Type, 'NO' as 'Null', '' as 'Key','' as 'Default' , '' as 'Extra'
FROM         sysobjects INNER JOIN
                      syscolumns ON sysobjects.id = syscolumns.id INNER JOIN
                      systypes ON syscolumns.xtype = systypes.xtype
WHERE     (sysobjects.xtype = 'U') and sysobjects.name='{$this->table_name}'
ORDER BY sysobjects.name, syscolumns.colid";


        $substituindo_mssql=$this->db->query($query);


davidoster

davidoster
  • profile picture
  • Member

Posted 05 July 2013 - 20:41 PM

I'm starting to migrate to Sql Server ... if anyone can give me some pointers?
Follows what has already shifted

 

        $query = "
SELECT     syscolumns.name AS Field, systypes.name +  '('+ CAST(syscolumns.LENGTH as varchar) + ')'  as Type, 'NO' as 'Null', '' as 'Key','' as 'Default' , '' as 'Extra'
FROM         sysobjects INNER JOIN
                      syscolumns ON sysobjects.id = syscolumns.id INNER JOIN
                      systypes ON syscolumns.xtype = systypes.xtype
WHERE     (sysobjects.xtype = 'U') and sysobjects.name='{$this->table_name}'
ORDER BY sysobjects.name, syscolumns.colid";


        $substituindo_mssql=$this->db->query($query);

 

 

Search on the forum.


ELJUSTICEIRO

ELJUSTICEIRO
  • profile picture
  • Member

Posted 05 July 2013 - 22:15 PM

I have searched and not found, you have the link?


davidoster

davidoster
  • profile picture
  • Member

Posted 05 July 2013 - 23:19 PM

Check here: /topic/1781-grocerycrud-with-various-database-support/?view=findpost&p=7969


goFrendiAsgard

goFrendiAsgard
  • profile picture
  • Member

Posted 05 July 2013 - 23:55 PM

I'm working on linux. And there is no such a free microsoft-sql-server for linux. Therefore, I can't help with sqlserver.
But I believe there are someone out there that will help to make groceryCRUD to be compatible with sqlserver.
If you really want groceryCRUD to be compatible with sqlserver, please consider to contribute to this https://github.com/scoumbourdis/grocery-crud-databases

 

 

There are 2 options:

- modify grocery_crud_model_pdo.php

- modify grocery_crud_model_sqlsrv.php

 

For the first one, you need to use PDO. However, it is a good try to use that and fix things based on error appeared.


davidoster

davidoster
  • profile picture
  • Member

Posted 06 July 2013 - 05:02 AM

Oh! I thought there was some model code for MSSQL. Sorry people.